nfc: s3fwrn5: allocate rx skb before consuming bytes
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 3f52c2cb7e3ada37513dabb69a22cf917dba754f · < 09822d3d6f68a0cdc4626e0c507324a4927f55a9| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
nfc: s3fwrn5: allocate rx skb before consuming bytes
s3fwrn82_uart_read() reports the number of accepted bytes to the serdev core. The current code consumes bytes into recv_skb and may already deliver a complete frame before allocating a fresh receive buffer.
If that alloc_skb() fails, the callback returns 0 even though it has already consumed bytes, and it leaves recv_skb as NULL for the next receive callback. That breaks the receive_buf() accounting contract and can also lead to a NULL dereference on the next skb_put_u8().
Allocate the receive skb lazily before consuming the next byte instead. If allocation fails, return the number of bytes already accepted.
From the CVE record · Linux
The Linux kernel’s s3fwrn5 NFC UART receive callback can consume bytes before failing to allocate a new receive buffer. If allocation fails, it may report the wrong byte count and leave a NULL buffer that can be dereferenced on the next receive callback. The input does not specify attacker access, authentication requirements, or user interaction.
Engineers running Linux kernels with the s3fwrn5 NFC driver should check their kernel versions; affected versions are not specified.