From: Bart Van Assche <bvanassche@acm.org>
To: Thanh Nguyen <thanhnguyentuan2007@gmail.com>,
Jens Axboe <axboe@kernel.dk>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Ming Lei <ming.lei@redhat.com>,
linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
syzbot+4138704b4276d9a57251@syzkaller.appspotmail.com
Subject: Re: [PATCH] sbitmap: reset alloc_hint to NULL after freeing
Date: Wed, 2 Dec 2026 07:02:33 -0800 [thread overview]
Message-ID: <46018d9e-df6c-499c-adbb-4de10edc8806@acm.org> (raw)
In-Reply-To: <20261202041507.603-1-thanhnguyentuan2007@gmail.com>
On 12/1/26 8:15 PM, Thanh Nguyen wrote:
> diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
> index cc7ad189c..620480e33 100644
> --- a/include/linux/sbitmap.h
> +++ b/include/linux/sbitmap.h
> @@ -185,6 +185,7 @@ static inline unsigned int __map_depth(const struct sbitmap *sb, int index)
> static inline void sbitmap_free(struct sbitmap *sb)
> {
> free_percpu(sb->alloc_hint);
> + sb->alloc_hint = NULL;
> kvfree(sb->map);
> sb->map = NULL;
> }
> diff --git a/lib/sbitmap.c b/lib/sbitmap.c
> index 4d188d05d..59879e27d 100644
> --- a/lib/sbitmap.c
> +++ b/lib/sbitmap.c
> @@ -119,6 +119,7 @@ int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift,
>
> if (depth == 0) {
> sb->map = NULL;
> + sb->alloc_hint = NULL;
> return 0;
> }
>
> @@ -132,6 +133,7 @@ int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift,
> sb->map = kvzalloc_node(sb->map_nr * sizeof(*sb->map), flags, node);
> if (!sb->map) {
> free_percpu(sb->alloc_hint);
> + sb->alloc_hint = NULL;
> return -ENOMEM;
> }
>
This patch looks more complete to me:
https://lore.kernel.org/linux-block/d8da37180d44f60c0d4345683bfa2e3a2cfb8335.1795999192.git.bvanassche@acm.org/
Thanks,
Bart.
next prev parent reply other threads:[~2026-12-02 15:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 4:15 Thanh Nguyen
2026-12-02 15:02 ` Bart Van Assche [this message]
2026-12-02 15:18 ` thanhnguyentuan2007
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46018d9e-df6c-499c-adbb-4de10edc8806@acm.org \
--to=bvanassche@acm.org \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+4138704b4276d9a57251@syzkaller.appspotmail.com \
--cc=thanhnguyentuan2007@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®