Skip to contentSkip to conversation

USB: mos7720: use GFP_ATOMIC under spinlock

PATCH In review Dan Carpenter 3 participants 3 messages Aug 16, 2013

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

PATCH 1/1 USB: mos7720: use GFP_ATOMIC under spinlock

The write_parport_reg_nonblock() function shouldn't sleep because it's called with spinlocks held.

---

drivers/usb/serial/mos7720.c +1 -1
index b013001..248fda6 100644
@@ -374,7 +374,7 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
 		kfree(urbtrack);
 		return -ENOMEM;
 	}
-	urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_KERNEL);
+	urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_ATOMIC);
 	if (!urbtrack->setup) {
 		usb_free_urb(urbtrack->urb);
 		kfree(urbtrack);
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Dan Carpenter

The write_parport_reg_nonblock() function shouldn't sleep because it's called with spinlocks held.

Ouch. Thanks for catching this.

Quoted 1 line

Greg, this one is needed in 3.11 (with a stable tag) as the offending commit ef6c8c1d ("USB: mos7720: fix broken control requests") is in usb-3.11-rc6.

Thanks,
Johan

Quoted 15 lines

---

drivers/usb/serial/mos7720.c +1 -1
index b013001..248fda6 100644
@@ -374,7 +374,7 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
 		kfree(urbtrack);
 		return -ENOMEM;
 	}
-	urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_KERNEL);
+	urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_ATOMIC);
 	if (!urbtrack->setup) {
 		usb_free_urb(urbtrack->urb);
 		kfree(urbtrack);
#2 lore raw
In reply to Dan Carpenter
Quoted 6 lines · Johan Hovold
Quoted 2 lines · Dan Carpenter

The write_parport_reg_nonblock() function shouldn't sleep because it's called with spinlocks held.

Ouch. Thanks for catching this.

Quoted 8 lines
Quoted 1 line

Greg, this one is needed in 3.11 (with a stable tag) as the offending commit ef6c8c1d ("USB: mos7720: fix broken control requests") is in usb-3.11-rc6.

Ok, I'll mark it as such, thanks.

greg k-h