Re: [PATCH v2] lpfc: Fix possible NULL pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2016-08-02 at 01:17 -0400, Martin K. Petersen wrote:
> > > > > > "Johannes" == Johannes Thumshirn <jthumshirn@xxxxxxx>
> > > > > > 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

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux