Re: [BK PATCH] More USB changes for 2.5.38

Greg KH
2002-09-27T19:41:47Z

# ChangeSet 1.611.1.6 -> 1.611.1.7
# drivers/usb/storage/transport.c 1.35 -> 1.36
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/26 yuri@acronis.com 1.611.1.7
# [PATCH] USB storage: Another (!) patch for the abort handler
#
# This is a simple, obvious patch for the abort handler. I don't know how
# we missed it before.
#
# Fix abort problem: us->srb was used after it was erased.
# --------------------------------------------
#
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c Fri Sep 27 12:30:11 2002
+++ b/drivers/usb/storage/transport.c Fri Sep 27 12:30:11 2002
@@ -859,6 +859,7 @@
* This must be called with scsi_lock(us->srb->host) held */
void usb_stor_abort_transport(struct us_data *us)
{
+ struct Scsi_Host *host;
int state = atomic_read(&us->sm_state);

US_DEBUGP("usb_stor_abort_transport called\n");
@@ -870,7 +871,8 @@

/* set state to abort and release the lock */
atomic_set(&us->sm_state, US_STATE_ABORTING);
- scsi_unlock(us->srb->host);
+ host = us->srb->host;
+ scsi_unlock(host);

/* If the state machine is blocked waiting for an URB or an IRQ,
* let's wake it up */
@@ -892,8 +894,8 @@
/* Wait for the aborted command to finish */
wait_for_completion(&us->notify);

- /* Reacquire the lock */
- scsi_lock(us->srb->host);
+ /* Reacquire the lock: note that us->srb is now NULL */
+ scsi_lock(host);
}

/*