nfc: llcp: avoid userspace overflow on invalid optlen
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 26fd76cab2e61cedc5c25f7151fb31b57ddc53c7 · < 8bf228fa02b1ed8ce622fb81fa8edc42be9aeb67| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
nfc: llcp: avoid userspace overflow on invalid optlen
nfc_llcp_getsockopt() casts optval to (u32 __user *) for put_user(), so the kernel always stores 4 bytes regardless of the caller-supplied optlen. The existing min_t(u32, len, sizeof(u32)) only clamps the length reported back to userspace; it does not constrain the store. A call with optlen < 4 therefore writes past the user buffer, violating the getsockopt(2) contract for all five supported optnames.
Reject any call with optlen < sizeof(u32) up front. 'len' is int, so a plain size comparison would promote a negative optlen to size_t and slip past the check; an explicit 'len < 0' test is added first to catch negative values before the size compare.
From the CVE record · Linux
The Linux kernel’s NFC LLCP getsockopt handler writes four bytes to a userspace buffer even when the caller supplies an optlen smaller than four. A local caller can trigger a write past that buffer by making such a call; no other user interaction is described.
Engineers running Linux kernels with NFC LLCP support should check whether their kernel includes this fix; affected versions were not specified.