From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>,
Johannes Thumshirn <jthumshirn@suse.de>
Cc: Linux SCSI Mailinglist <linux-scsi@vger.kernel.org>,
Tyrel Datwyler <turtle.in.the.kernel@gmail.com>,
James Smart <james.smart@broadcom.com>
Subject: Re: [PATCH v2] lpfc: Fix possible NULL pointer dereference
Date: Thu, 08 Dec 2016 11:01:30 -0800 [thread overview]
Message-ID: <1481223690.2361.13.camel@HansenPartnership.com> (raw)
In-Reply-To: <yq1ziovn40r.fsf@sermon.lab.mkp.net>
On Tue, 2016-08-02 at 01:17 -0400, Martin K. Petersen wrote:
> > > > > > "Johannes" == Johannes Thumshirn <jthumshirn@suse.de>
> > > > > > writes:
>
> Johannes> Check for the existence of piocb->vport before accessing
> it.
>
> Applied to 4.8/scsi-queue.
OK, now that this has caused problems, could learn the lessons from it?
Lines like this:
+ BUG_ON(!piocb || !piocb->vport);
Should never appear in code. They only have the potential to cause
problems if the condition is inexact and they provide precisely no
information over what a NULL deref in the kernel is going to tell us
anyway ... this one even obscures information because you don't know if
pciob was null or pciob->vport when it triggers.
The rule is never BUG_ON a NULL pointer unless you have an extremely
good reason why the kernel NULL deref handler isn't adequate (which
should be documented in the commit log).
James
next prev parent reply other threads:[~2016-12-08 19:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-29 13:30 [PATCH v2] lpfc: Fix possible NULL pointer dereference Johannes Thumshirn
2016-08-01 15:45 ` Tyrel Datwyler
2016-08-02 5:17 ` Martin K. Petersen
2016-12-08 19:01 ` James Bottomley [this message]
2016-12-09 9:45 ` 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=1481223690.2361.13.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=james.smart@broadcom.com \
--cc=jthumshirn@suse.de \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=turtle.in.the.kernel@gmail.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.