From: Sumit Saxena <sumit.saxena@broadcom.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Petros Koutoupis <petros@petroskoutoupis.com>
Cc: Finn Thain <fthain@telegraphics.com.au>,
kashyap.desai@avagotech.com, sumit.saxena@avagotech.com,
uday.lingala@avagotech.com, megaraidlinux.pdl@avagotech.com,
linux-scsi@vger.kernel.org
Subject: RE: [PATCH] megaraid: add scsi_cmnd NULL check before use
Date: Thu, 12 May 2016 18:05:23 +0530 [thread overview]
Message-ID: <410ee24683f9720077661b90b0472ce7@mail.gmail.com> (raw)
In-Reply-To: <20160512062948.GG19274@mwanda>
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Thursday, May 12, 2016 12:05 PM
> To: Petros Koutoupis
> Cc: Sumit Saxena; Finn Thain; kashyap.desai@avagotech.com;
> sumit.saxena@avagotech.com; uday.lingala@avagotech.com;
> megaraidlinux.pdl@avagotech.com; linux-scsi@vger.kernel.org
> Subject: Re: [PATCH] megaraid: add scsi_cmnd NULL check before use
>
> On Wed, May 11, 2016 at 08:49:51PM -0500, Petros Koutoupis wrote:
> > Sumit,
> >
> > I will resubmit the patch with all the recommendations. Thank you. In
> > case you are interested, I have a crash file showcasing the error. I
> > can always provide this outside of this mailing thread.
> >
>
> Please send it to the thread.
>
> To be honest, I totally can't understand this thread. Sumit says it is
impossible
> and you are saying that you have seen it happen in real life.
> Are you using out of tree code or something? What are you doing that is
> unexpected?
>
> I don't see the point of adding a WARN_ON(). NULL derefs normally
generate a
> pretty clear stack trace already (unless they are caused by memory
corruption).
> Why are we not just fixing the bugs instead of warning and then
crashing.
Agree, if there scsi_cmnd is coming as NULL, please attach logs. I will
look into them.
>
> Also when I'm doing static analysis people always tell me that "that bug
is
> impossible, trust me." and instead of trusting people I really wish they
would just
> show me the relevant code that prevents it from happening.
Inside megasas_build_io_fusion() function, driver sets "cmd->scmd"
pointer(SCSI command pointer received from SCSI mid layer). Functions
called inside megasas_build_io_fusion()(which actually builds frame to be
sent to firmware)
are setting Function type- MPI2_FUNCTION_SCSI_IO_REQUEST (or)
MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST. So in case Function type set to any
one these two, there must be valid "cmd->scmd".
Thanks,
Sumit
>
> regards,
> dan carpenter
next prev parent reply other threads:[~2016-05-12 12:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-08 0:40 [PATCH] megaraid: add scsi_cmnd NULL check before use Petros Koutoupis
2016-05-08 3:32 ` Finn Thain
2016-05-08 12:08 ` Petros Koutoupis
2016-05-08 12:22 ` Finn Thain
2016-05-08 16:34 ` Petros Koutoupis
2016-05-09 1:35 ` Julian Calaby
2016-05-09 2:59 ` Petros Koutoupis
2016-05-09 8:05 ` Dan Carpenter
2016-05-09 9:43 ` Dan Carpenter
2016-05-09 9:48 ` Sumit Saxena
2016-05-09 19:29 ` Dan Carpenter
2016-05-09 21:28 ` Petros Koutoupis
2016-05-11 9:41 ` Sumit Saxena
2016-05-12 1:49 ` Petros Koutoupis
2016-05-12 6:35 ` Dan Carpenter
2016-05-12 12:35 ` Sumit Saxena [this message]
2016-05-13 7:43 ` Finn Thain
2016-05-13 7:43 ` Sumit Saxena
2016-05-13 9:25 ` Finn Thain
2016-05-13 23:34 ` Petros Koutoupis
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=410ee24683f9720077661b90b0472ce7@mail.gmail.com \
--to=sumit.saxena@broadcom.com \
--cc=dan.carpenter@oracle.com \
--cc=fthain@telegraphics.com.au \
--cc=kashyap.desai@avagotech.com \
--cc=linux-scsi@vger.kernel.org \
--cc=megaraidlinux.pdl@avagotech.com \
--cc=petros@petroskoutoupis.com \
--cc=sumit.saxena@avagotech.com \
--cc=uday.lingala@avagotech.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).