[RFC]cdc-wdm: fix deadlock in scheduled work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 5cfcd26b872719089dd714b5b1047d4d6e985889 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@xxxxxxx>
Date: Tue, 20 Jan 2015 15:28:53 +0100
Subject: [PATCH] cdc-wdm: fix deadlock in scheduled work

The scheduled work can deadlock in the error
handling case.

kmalloc with GFP_KERNEL in the work
VM layer decides to page to storage interface
task blocks waiting for completion of IO

SCSI layer sees an error
SCSI error handling starts
SCSI layer requests a bus reset

USB layer calls pre_reset() of cdc-wdm
wdm_pre_reset() calls cancel_work_sync()
cancel_work_sync() waits for work to finish
DEADLOCK

Signed-off-by: Oliver Neukum <oneukum@xxxxxxx>
---
 drivers/usb/class/cdc-wdm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index e24bad6..93dd8b8 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -738,7 +738,7 @@ static void wdm_rxwork(struct work_struct *work)
 		responding = test_and_set_bit(WDM_RESPONDING, &desc->flags);
 		spin_unlock_irqrestore(&desc->iuspin, flags);
 		if (!responding)
-			rv = usb_submit_urb(desc->response, GFP_KERNEL);
+			rv = usb_submit_urb(desc->response, GFP_NOIO);
 		if (rv < 0 && rv != -EPERM) {
 			spin_lock_irqsave(&desc->iuspin, flags);
 			clear_bit(WDM_RESPONDING, &desc->flags);
-- 
1.8.4.5



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux