From: Jens Axboe <axboe@kernel.dk>
To: Colin Ian King <colin.king@canonical.com>,
Christoph Hellwig <hch@lst.de>,
Johannes Thumshirn <jthumshirn@suse.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: mtip32xx: add a status field to struct mtip_cmd
Date: Fri, 21 Apr 2017 08:14:03 -0600 [thread overview]
Message-ID: <f617c365-4459-6a8c-61a9-7494f8d4166b@kernel.dk> (raw)
In-Reply-To: <933d95b1-ee6c-eb74-9197-32852e7f7728@canonical.com>
On 04/21/2017 08:06 AM, Colin Ian King wrote:
> Hi,
>
> CoverityScan found an issue with the following part of the patch:
>
> - if (likely(!reserv))
> - blk_mq_complete_request(rq, -ENODEV);
> - else if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &dd->port->flags)) {
> + if (likely(!reserv)) {
> + cmd->status = -ENODEV;
> + blk_mq_complete_request(rq, 0);
> + } else if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &dd->port->flags)) {
>
>
From: Jens Axboe <axboe@fb.com>
Subject: [PATCH] mtip32xx: fix dereference of stack garbage
We need to get the command payload from the request before
we attempt to dereference it.
Fixes: 4dda4735c581 ("mtip32xx: add a status field to struct mtip_cmd")
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 66a6bd83faae..54c8736038de 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -4108,6 +4108,7 @@ static void mtip_no_dev_cleanup(struct request *rq, void *data, bool reserv)
struct mtip_cmd *cmd;
if (likely(!reserv)) {
+ cmd = blk_mq_rq_to_pdu(rq);
cmd->status = -ENODEV;
blk_mq_complete_request(rq);
} else if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &dd->port->flags)) {
--
Jens Axboe
next prev parent reply other threads:[~2017-04-21 14:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 14:06 Colin Ian King
2017-04-21 14:14 ` Jens Axboe [this message]
2017-04-21 14:37 ` Christoph Hellwig
2017-04-21 14:47 ` Jens Axboe
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=f617c365-4459-6a8c-61a9-7494f8d4166b@kernel.dk \
--to=axboe@kernel.dk \
--cc=colin.king@canonical.com \
--cc=hch@lst.de \
--cc=jthumshirn@suse.de \
--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®