can: esd_usb: kill anchored URBs before freeing netdevs
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 96d8e90382dc336b5de401164597edfdc2e8d9f1 · < 5832c55b3c824ba2fe9c36ac3c411baddcce053e| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
can: esd_usb: kill anchored URBs before freeing netdevs
esd_usb_disconnect() frees each CAN netdev with free_candev() inside its per-netdev loop and only calls unlink_all_urbs(dev) afterwards. The per-netdev private data (struct esd_usb_net_priv) is embedded in the net_device allocation returned by alloc_candev(), so once free_candev() has run, dev->nets[i] points to freed memory. unlink_all_urbs() then dereferences the freed dev->nets[i] to kill the per-netdev TX anchor (usb_kill_anchored_urbs(&priv->tx_submitted)), clear active_tx_jobs, and reset priv->tx_contexts[].
Reorder the teardown so the anchored URBs are killed before the netdevs are freed, matching other CAN/USB drivers in the same directory such as ems_usb, usb_8dev and mcba_usb, which unregister, then unlink, then free: unregister the netdevs first (which stops their TX queues), call unlink_all_urbs(dev) once, then free the netdevs.
This issue was found by an in-house static analysis tool.
From the CVE record · Linux
The Linux kernel's esd_usb CAN driver can access freed netdev memory while disconnecting a device. This occurs when it kills anchored USB requests after freeing the netdevs. The input does not establish whether an attacker can trigger the issue or whether authentication or user interaction is required.
Engineers running Linux kernels with the esd_usb CAN driver should check whether their kernel is affected; affected versions are not specified.