From: Bart Van Assche <bvanassche@acm.org>
To: Johannes Thumshirn <jthumshirn@suse.de>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Linux Kernel Mailinglist <linux-kernel@vger.kernel.org>,
Linux SCSI Mailinglist <linux-scsi@vger.kernel.org>,
Hannes Reinecke <hare@suse.de>, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] scsi: sd: don't crash the host on invalid commands
Date: Thu, 20 Sep 2018 11:18:19 -0700 [thread overview]
Message-ID: <1537467499.224533.21.camel@acm.org> (raw)
In-Reply-To: <20180920071907.10102-1-jthumshirn@suse.de>
On Thu, 2018-09-20 at 09:19 +0200, Johannes Thumshirn wrote:
> When sd_init_command() get's a with a unknown req_op() it crashes the
> system via BUG().
>
> This makes debugging the actual reason for the broken request
> cmd_flags pretty hard as the system is down before it's able to write
> out debugging data on the serial console or the trace buffer.
>
> Change the BUG() to a WARN_ON() and return BLKPREP_KILL to fail
> gracefully and return an I/O error to the producer of the request.
>
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Bart Van Assche <bvanassche@acm.org>
> Cc: Christoph Hellwig <hch@lst.de>
> ---
> Fixed Typo in Bart's mail, sorry for this.
>
> drivers/scsi/sd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index b79b366a94f7..19f28962d65b 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -1276,7 +1276,8 @@ static int sd_init_command(struct scsi_cmnd *cmd)
> case REQ_OP_ZONE_RESET:
> return sd_zbc_setup_reset_cmnd(cmd);
> default:
> - BUG();
> + WARN_ON(1);
> + return BLKPREP_KILL;
> }
> }
Have you considered to use WARN_ON_ONCE() instead of WARN_ON(1)? Otherwise
this patch looks good to me.
Thanks,
Bart.
next prev parent reply other threads:[~2018-09-20 18:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 7:19 [PATCH] scsi: sd: don't crash the host on invalid commands Johannes Thumshirn
2018-09-20 7:33 ` Christoph Hellwig
2018-09-20 18:18 ` Bart Van Assche [this message]
2018-09-21 6:29 ` Johannes Thumshirn
-- strict thread matches above, loose matches on Subject: below --
2018-09-20 7:15 Johannes Thumshirn
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=1537467499.224533.21.camel@acm.org \
--to=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jthumshirn@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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 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.