]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: libipw: fix key index receive bound checks
authorPengpeng Hou <pengpeng@iscas.ac.cn>
Sun, 5 Jul 2026 08:35:19 +0000 (16:35 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 6 Jul 2026 12:11:09 +0000 (14:11 +0200)
libipw_rx() reads skb->data[hdrlen + 3] to extract the WEP key index in
both the software-decrypt key selection path and the hardware-decrypted
IV/ICV strip path. In both places the existing guard only checks
skb->len >= hdrlen + 3, which proves bytes up to hdrlen + 2 but not the
byte at hdrlen + 3.

Require hdrlen + 4 bytes before reading that item in both paths. This is
a local source-boundary check only; it does not change the key index
semantics.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260705083519.23567-1-pengpeng@iscas.ac.cn
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/ipw2x00/libipw_rx.c

index b7bc94f7abd8aad6feb4ad1a06eaf0e64c260ae2..c8841f9b9ad918e26931afc53baad8d0221e866b 100644 (file)
@@ -414,7 +414,7 @@ int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb,
            ieee->host_mc_decrypt : ieee->host_decrypt;
 
        if (can_be_decrypted) {
-               if (skb->len >= hdrlen + 3) {
+               if (skb->len >= hdrlen + 4) {
                        /* Top two-bits of byte 3 are the key index */
                        keyidx = skb->data[hdrlen + 3] >> 6;
                }
@@ -660,7 +660,7 @@ int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb,
                int trimlen = 0;
 
                /* Top two-bits of byte 3 are the key index */
-               if (skb->len >= hdrlen + 3)
+               if (skb->len >= hdrlen + 4)
                        keyidx = skb->data[hdrlen + 3] >> 6;
 
                /* To strip off any security data which appears before the