Re: [BK PATCH] More USB changes for 2.5.38

Greg KH (greg@kroah.com)
Fri, 27 Sep 2002 12:43:30 -0700


# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# 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);
}

/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/