On 06/01/2012 03:14 PM, Mike Christie wrote: > On 06/01/2012 11:47 AM, Rustad, Mark D wrote: >> Mike, >> >> On May 31, 2012, at 8:16 PM, Mike Christie wrote: >> >>> On 05/31/2012 07:14 PM, Mark Rustad wrote: >>>> Signed-off-by: Mark Rustad <[email protected]> >>>> Tested-by: Marcus Dennis <[email protected]> >>>> --- >>>> >>>> include/scsi/scsi_cmnd.h | 8 +++++++- >>>> 1 files changed, 7 insertions(+), 1 deletions(-) >>>> >>>> diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h >>>> index 1e11985..ac06cc5 100644 >>>> --- a/include/scsi/scsi_cmnd.h >>>> +++ b/include/scsi/scsi_cmnd.h >>>> @@ -134,10 +134,16 @@ struct scsi_cmnd { >>>> >>>> static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) >>>> { >>>> + struct scsi_driver **sdp; >>>> + >>>> if (!cmd->request->rq_disk) >>>> return NULL; >>>> >>>> - return *(struct scsi_driver **)cmd->request->rq_disk->private_data; >>>> + sdp = (struct scsi_driver **)cmd->request->rq_disk->private_data; >>>> + if (!sdp) >>>> + return NULL; >>>> + >>>> + return *sdp; >>>> } >>> >>> Upstream commit: >>> >>> Author: Martin K. Petersen <[email protected]> >>> Date: Sat Apr 14 23:01:28 2012 -0400 >>> >>> SCSI: Fix error handling when no ULD is attached >>> >>> should fix this. >> >> >> If you look closely, you will see that this patch applies on top of that >> patch. Martin's patch addressed the possibility of rq_disk being NULL. This >> patch adds checking private_data for NULL before dereferencing it. >> > > Ah funny. I guess things got messed up in that thread. I do not think > everyone was talking about the same thing. In it, I was saying the > problem was in the driver being null > http://marc.info/?l=linux-usb&m=133407600206379&w=2 > I thought we added the null driver check in that patch for that case, > but did not handle scsi_cmd_to_driver's dereference. > > It does not make sense to me why we are doing a ** instead of just a > normal old pointer. Was > > sd.c: > gd->private_data = &sdkp->driver; > supposed to just be > gd->private_data = sdkp->driver; >
or just do gd->private_data = &sd_template; _______________________________________________ devel mailing list [email protected] https://lists.open-fcoe.org/mailman/listinfo/devel
