From: Dan Carpenter <dan.carpenter@oracle.com> To: Ulf Hansson <ulf.hansson@linaro.org>, Adrian Hunter <adrian.hunter@intel.com> Cc: Linus Walleij <linus.walleij@linaro.org>, Shawn Lin <shawn.lin@rock-chips.com>, linux-mmc@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] mmc: block: blk-mq: Potential NULL deref on mmc_blk_alloc_req() failure Date: Fri, 08 Dec 2017 11:55:16 +0000 [thread overview] Message-ID: <20171208115516.3h55rvjq54hyfecq@mwanda> (raw) mmc_blk_alloc_req() is supposed to return error pointers but there is one path where we forget to set the error code and accidentally return NULL. The callers are not expecting that and will have a NULL pointer dereference. Fixes: 23da8bed11f2 ("mmc: block: Simplify cleaning up the queue") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index ab384ba6cb37..6af2b660b1f7 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -3037,6 +3037,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, */ if (!blk_get_queue(md->queue.queue)) { mmc_cleanup_queue(&md->queue); + ret = -ENODEV; goto err_putdisk; }
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com> To: Ulf Hansson <ulf.hansson@linaro.org>, Adrian Hunter <adrian.hunter@intel.com> Cc: Linus Walleij <linus.walleij@linaro.org>, Shawn Lin <shawn.lin@rock-chips.com>, linux-mmc@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] mmc: block: blk-mq: Potential NULL deref on mmc_blk_alloc_req() failure Date: Fri, 8 Dec 2017 14:55:16 +0300 [thread overview] Message-ID: <20171208115516.3h55rvjq54hyfecq@mwanda> (raw) mmc_blk_alloc_req() is supposed to return error pointers but there is one path where we forget to set the error code and accidentally return NULL. The callers are not expecting that and will have a NULL pointer dereference. Fixes: 23da8bed11f2 ("mmc: block: Simplify cleaning up the queue") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index ab384ba6cb37..6af2b660b1f7 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -3037,6 +3037,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, */ if (!blk_get_queue(md->queue.queue)) { mmc_cleanup_queue(&md->queue); + ret = -ENODEV; goto err_putdisk; }
next reply other threads:[~2017-12-08 11:55 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-12-08 11:55 Dan Carpenter [this message] 2017-12-08 11:55 ` [PATCH] mmc: block: blk-mq: Potential NULL deref on mmc_blk_alloc_req() failure Dan Carpenter 2017-12-08 12:02 ` Adrian Hunter 2017-12-08 12:02 ` Adrian Hunter 2017-12-11 12:29 ` Ulf Hansson 2017-12-11 12:29 ` Ulf Hansson
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=20171208115516.3h55rvjq54hyfecq@mwanda \ --to=dan.carpenter@oracle.com \ --cc=adrian.hunter@intel.com \ --cc=kernel-janitors@vger.kernel.org \ --cc=linus.walleij@linaro.org \ --cc=linux-mmc@vger.kernel.org \ --cc=shawn.lin@rock-chips.com \ --cc=ulf.hansson@linaro.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.