Re: An oops will occur while SCSI core is being used in 3.4-rc1

Bart Van Assche
2012-04-11T20:01:22Z

On 04/11/12 16:40, Bart Van Assche wrote:

> On 04/11/12 16:10, Martin K. Petersen wrote:
>> index 377df4a..1e11985 100644
>> --- a/include/scsi/scsi_cmnd.h
>> +++ b/include/scsi/scsi_cmnd.h
>> @@ -134,6 +134,9 @@ struct scsi_cmnd {
>>
>> static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
>> {
>> + if (!cmd->request->rq_disk)
>> + return NULL;
>> +
>> return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
>> }
>
> What if the rq_disk pointer is cleared by another kernel thread after it
> has been checked but before it is used ?

(replying to my own e-mail)

That comment didn't make sense - request.rq_disk is not modified after
it has been initialized. Yet it would make me more happy if
scsi_send_eh_cmnd() could be modified such that it doesn't have to
access struct scsi_driver.

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