Re: [PATCH 03/21] uas: Fix resetting flag handling

Hans de Goede
2014-09-10T13:50:39Z

Hi,

First of all, thank you for reviewing this.

On 09/10/2014 03:40 PM, Oliver Neukum wrote:
> On Wed, 2014-09-10 at 13:46 +0200, Hans de Goede wrote:
>> - Make sure we always hold the lock when setting / checking resetting
>> - Check resetting before checking urb->status
>> - Add missing check for resetting to uas_data_cmplt
>> - Add missing check for resetting to uas_do_work
>
> Why is the checking for stat and data inconsistent?

With stat urbs there is no direct reference from the urb
to the scsi cmnd, since when using usb-2 the sense urbs
may arrive in a different order then the cmnds where issued.
instead for sense urbs we look up the cmnd by tag, likewise
there is no reference from the cmnd back to the sense-urb.

For data urbs however the urb->context pointer points directly
to the cmnd struct, and the cmnd struct has a pointer back in
the form of devinfo->data_[in|out]_urb. When the urb completes
we want to NULL the devinfo->data_[in|out]_urb pointers even
when resetting. So that we don't try to deref a pointer to
a free-ed urb later on (this does not become an issue until
after the "uas: Free data urbs on completion" commit).

Regards,

Hans