OSDN Git Service

uas: Do not use scsi_host_find_tag
authorHans de Goede <hdegoede@redhat.com>
Sat, 13 Sep 2014 10:26:32 +0000 (12:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Sep 2014 04:42:10 +0000 (21:42 -0700)
commit5e61aede477ee108de3f9e57f19cacd8ce3ffe52
treef02bddfe141a29490935ef859f779523afde94a9
parente0620001e4e318d85ebf43a95eec15fae26ed706
uas: Do not use scsi_host_find_tag

Using scsi_host_find_tag with tags returned by the device is unsafe for
multiple reasons:

1) It returns tags->rqs[tag], which may be non NULL even when the cmnd is
   not owned by us
2) It returns tags->rqs[tag], without holding any locks protecting it
3) It returns tags->rqs[tag], without doing any boundary checking

Instead keep our own list which maps tags -> inflight cmnds.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/uas.c