Skip to contentSkip to conversation

usb: image: microtek: stop SG processing after transfer errors

PATCH In review Diego Fernando Mancera Gomez 2 participants 2 messages Jul 23 – Jul 28

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: image: microtek: stop SG processing after transfer errors

When an SG URB completes with an error, mts_do_sg() calls mts_transfer_cleanup(), which completes the SCSI command through scsi_done(). However, the callback continues advancing the scatterlist and may submit another URB for a command that has already been completed.

Return immediately after the cleanup so that no further processing is performed on the completed command.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/usb/image/microtek.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/image/microtek.c +1 -0
index 1f0b3c44d388..787cf5aba55d 100644
@@ -475,6 +475,7 @@ static void mts_do_sg (struct urb* transfer)
 	if (unlikely(status)) {
                 set_host_byte(context->srb, (status == -ENOENT ? DID_ABORT : DID_ERROR));
 		mts_transfer_cleanup(transfer);
+		return;
         }
 
 	context->curr_sg = sg_next(context->curr_sg);
Signature · 1 line
2.43.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Diego Fernando Mancera Gomez

When an SG URB completes with an error, mts_do_sg() calls mts_transfer_cleanup(), which completes the SCSI command through scsi_done(). However, the callback continues advancing the scatterlist and may submit another URB for a command that has already been completed.

Return immediately after the cleanup so that no further processing is performed on the completed command.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")