USB: gadget: fix NULL pointer dereference in gadget_dev_ioctl()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 · < c29a83c1ff3f06d5751f6d365b606c9f81ccc4cb| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
USB: gadget: fix NULL pointer dereference in gadget_dev_ioctl()
gadget_dev_ioctl() reads dev->gadget before acquiring dev->lock, but dev->state is checked after acquiring the lock. Therefore a concurrent bind can change the device state between these operations, which can leave ioctl with a stale NULL gadget pointer and causing a NULL pointer dereference at gadget->ops->ioctl.
Read dev->gadget while holding dev->lock so that the gadget pointer and device state are sampled consistently.
From the CVE record · Linux
The Linux kernel’s gadget_dev_ioctl() reads the gadget pointer before acquiring the device lock. If a bind occurs concurrently with an ioctl, the ioctl can dereference a stale NULL pointer. The input does not specify access requirements or user interaction.
Engineers running Linux kernels with the USB gadget component should check whether their kernel includes this fix; affected versions are not specified.