Commit 18c2ebca authored by Johan Hovold's avatar Johan Hovold Committed by Ben Hutchings

USB: kobil_sct: fix non-atomic allocation in write path

commit 19125283 upstream.

Write may be called from interrupt context so make sure to use
GFP_ATOMIC for all allocations in write.

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
[bwh: Backported to 3.2:
 - s/interrupt_out_urb/write_urb/
 - Adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 731738e0
...@@ -463,7 +463,8 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -463,7 +463,8 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
); );
priv->cur_pos = priv->cur_pos + length; priv->cur_pos = priv->cur_pos + length;
result = usb_submit_urb(port->write_urb, GFP_NOIO); result = usb_submit_urb(port->write_urb,
GFP_ATOMIC);
dbg("%s - port %d Send write URB returns: %i", dbg("%s - port %d Send write URB returns: %i",
__func__, port->number, result); __func__, port->number, result);
todo = priv->filled - priv->cur_pos; todo = priv->filled - priv->cur_pos;
...@@ -487,7 +488,7 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -487,7 +488,7 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
port->interrupt_in_urb->dev = port->serial->dev; port->interrupt_in_urb->dev = port->serial->dev;
result = usb_submit_urb(port->interrupt_in_urb, result = usb_submit_urb(port->interrupt_in_urb,
GFP_NOIO); GFP_ATOMIC);
dbg("%s - port %d Send read URB returns: %i", dbg("%s - port %d Send read URB returns: %i",
__func__, port->number, result); __func__, port->number, result);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment