From: "Tobin C. Harding" <me@tobin.cc>
To: Jens Axboe <axboe@kernel.dk>
Cc: "Tobin C. Harding" <me@tobin.cc>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] block: add NULL argument check to bioset_free()
Date: Mon, 2 Oct 2017 18:06:03 +1100 [thread overview]
Message-ID: <1506927963-27865-1-git-send-email-me@tobin.cc> (raw)
Currently bioset_free() will oops if passed a NULL argument. Other
kernel 'free' functions typically check for NULL arguments and
return. The rule of least surprise dictates that bioset_free() should
behave safely even if passed a NULL argument.
Add NULL argument check to bioset_free().
Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
block/bio.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/bio.c b/block/bio.c
index b38e962..780aecc 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1925,6 +1925,9 @@ mempool_t *biovec_create_pool(int pool_entries)
void bioset_free(struct bio_set *bs)
{
+ if (unlikely(!bs))
+ return;
+
if (bs->rescue_workqueue)
destroy_workqueue(bs->rescue_workqueue);
--
2.7.4
reply other threads:[~2017-10-02 7:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1506927963-27865-1-git-send-email-me@tobin.cc \
--to=me@tobin.cc \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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®