Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1570834
| From | James Bottomley <jejb@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: scsi: BUG in scsi_init_io |
| Date | 2017-01-31 16:50 +0100 |
| Message-ID | <t5IQV-2qi-1@gated-at.bofh.it> (permalink) |
| References | <t5CBP-7j5-3@gated-at.bofh.it> <t5CVd-7pw-37@gated-at.bofh.it> <t5Doe-7zo-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 2017-01-31 at 10:50 +0100, Dmitry Vyukov wrote: > On Tue, Jan 31, 2017 at 10:20 AM, Johannes Thumshirn < > jthumshirn@suse.de> wrote: > > On Tue, Jan 31, 2017 at 09:55:52AM +0100, Dmitry Vyukov wrote: > > > Hello, > > > > > > The following program triggers BUG in scsi_init_io: > > > > Well crashing a machine just because of an empty dma transfer is a > > bit harsh, > > isn't it? > > > > From 86e6fa5f618fe588b98e923e032f33e075fcd4f4 Mon Sep 17 00:00:00 > > 2001 > > From: Johannes Thumshirn <jthumshirn@suse.de> > > Date: Tue, 31 Jan 2017 10:16:00 +0100 > > Subject: [PATCH] scsi: don't BUG_ON() empty DMA transfers > > > > Don't crash the machine just because of an empty transfer. Use > > WARN_ON() > > combined with returning an error. > > > > Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> > > --- > > drivers/scsi/scsi_lib.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > > index e9e1e14..414588a 100644 > > --- a/drivers/scsi/scsi_lib.c > > +++ b/drivers/scsi/scsi_lib.c > > @@ -1040,7 +1040,8 @@ int scsi_init_io(struct scsi_cmnd *cmd) > > bool is_mq = (rq->mq_ctx != NULL); > > int error; > > > > - BUG_ON(!blk_rq_nr_phys_segments(rq)); > > + if (WARN_ON(!blk_rq_nr_phys_segments(rq))) > > + return -EINVAL; > > > Please-please-please, let's not use WARN for something that is not a > kernel bug and is user-triggerable. It is a kernel bug and it should not be user triggerable, so it should have a warn_on or bug_on. It means something called a data setup function with no data. There's actually a root cause that patches like this won't fix, can we find it? James
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
scsi: BUG in scsi_init_io Dmitry Vyukov <dvyukov@google.com> - 2017-01-31 10:10 +0100
Re: scsi: BUG in scsi_init_io Johannes Thumshirn <jthumshirn@suse.de> - 2017-01-31 10:30 +0100
Re: scsi: BUG in scsi_init_io Dmitry Vyukov <dvyukov@google.com> - 2017-01-31 11:00 +0100
Re: scsi: BUG in scsi_init_io Johannes Thumshirn <jthumshirn@suse.de> - 2017-01-31 11:00 +0100
Re: scsi: BUG in scsi_init_io Dmitry Vyukov <dvyukov@google.com> - 2017-01-31 11:10 +0100
Re: scsi: BUG in scsi_init_io James Bottomley <jejb@linux.vnet.ibm.com> - 2017-01-31 16:50 +0100
csiph-web