mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:04:51 +01:00
can: usb: f81604: correctly anchor the urb in the read bulk callback
When submitting an urb, that is using the anchor pattern, it needs to be
anchored before submitting it otherwise it could be leaked if
usb_kill_anchored_urbs() is called. This logic is correctly done
elsewhere in the driver, except in the read bulk callback so do that
here also.
Cc: Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Vincent Mailhol <mailhol@kernel.org>
Cc: stable@kernel.org
Assisted-by: gkh_clanker_2000
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/2026022334-starlight-scaling-2cea@gregkh
Fixes: 88da174369 ("can: usb: f81604: add Fintek F81604 support")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
51f9478072
commit
952caa5da1
1 changed files with 13 additions and 2 deletions
|
|
@ -413,6 +413,7 @@ static void f81604_read_bulk_callback(struct urb *urb)
|
|||
{
|
||||
struct f81604_can_frame *frame = urb->transfer_buffer;
|
||||
struct net_device *netdev = urb->context;
|
||||
struct f81604_port_priv *priv = netdev_priv(netdev);
|
||||
int ret;
|
||||
|
||||
if (!netif_device_present(netdev))
|
||||
|
|
@ -445,10 +446,15 @@ static void f81604_read_bulk_callback(struct urb *urb)
|
|||
f81604_process_rx_packet(netdev, frame);
|
||||
|
||||
resubmit_urb:
|
||||
usb_anchor_urb(urb, &priv->urbs_anchor);
|
||||
ret = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (!ret)
|
||||
return;
|
||||
usb_unanchor_urb(urb);
|
||||
|
||||
if (ret == -ENODEV)
|
||||
netif_device_detach(netdev);
|
||||
else if (ret)
|
||||
else
|
||||
netdev_err(netdev,
|
||||
"%s: failed to resubmit read bulk urb: %pe\n",
|
||||
__func__, ERR_PTR(ret));
|
||||
|
|
@ -652,10 +658,15 @@ static void f81604_read_int_callback(struct urb *urb)
|
|||
f81604_handle_tx(priv, data);
|
||||
|
||||
resubmit_urb:
|
||||
usb_anchor_urb(urb, &priv->urbs_anchor);
|
||||
ret = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (!ret)
|
||||
return;
|
||||
usb_unanchor_urb(urb);
|
||||
|
||||
if (ret == -ENODEV)
|
||||
netif_device_detach(netdev);
|
||||
else if (ret)
|
||||
else
|
||||
netdev_err(netdev, "%s: failed to resubmit int urb: %pe\n",
|
||||
__func__, ERR_PTR(ret));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue