From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 964FA2C21E6 for ; Sat, 25 Jul 2026 04:09:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784952571; cv=none; b=Tn4btEBFg3e8Z7bFyV+naVUFLssNi3YV5qBTUWGpwRsiH9CaxxHYYOaxbh5KPxwzch4EF1t+i6uj/CyJaFZXqseu/RX62VuTSWeeWiya6csRMmzrz7ueSaJPp1Q2W4Rpmrbk0DQbw8OMGGjYV6VkVXV2fPhEvbImQWTlIeuZUm0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784952571; c=relaxed/simple; bh=Wb0u2KS6isSDEaP8PHtxt4BBk7C8bBxFBTzkGOI112E=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=S9s7OQGlcOXCXin/krxPOwXaLloCdZkRDCfR9ykEXOItEtKP0Kn8AJKwVL2RaHnPJaRJbnC3N/yNIgOf7evoZr5TH9zJRIVDf3H4NtPgxvoSQkxJJDYodw+NbUqwzRv2Ag1QYZNFJVLLyLY7fEQdiNdWQWpDWOgxV+EUp48UzEA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.167.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oi1-f197.google.com with SMTP id 5614622812f47-4a5a66f375dso534427b6e.1 for ; Fri, 24 Jul 2026 21:09:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784952568; x=1785557368; h=content-type:to:from:subject:message-id:in-reply-to:date :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=9lB7YH1N2WDhm1eLRMxyvnGCfPPHTJgPjlRRyDyvIio=; b=QNpyy8keukqic5SULsKRar9h8+DfVHVL1lmAoWg5A180XKy+zPLzPjruFPR+2x20oS mECU6FhvJEClzJElHw0qhyeyFiYkqz6dAEO+W+tQXDc36mY8Q5uXWbuRMOGPv+RgKyXo m3+KczO99YQAzaoNa8WlpePPWSuoDRIlkpT/QJHL6ZgVq2FoYoAHyQzW3nce6bFUGMWR awLQPnXFToVpC1Q9t1ENz0jjv6WahKS6T0mtQjOPtU+YhA1p9aoA81TKrE64KsyqXc5+ 3TJTO2f7bu9kCW7VvukbXAsCI9enPa/1hWyvxGNDqDGTm39koprHag7AQJkuAjEhK25K UnGQ== X-Gm-Message-State: AOJu0YwyCbDbx5DXV25nfmlHM4SLAl2Qw09beH9k6v2m9bvaYhiygpBI 2Xz4xLcB+TmSVulBHl51bHf5XjLKC+/vAEAfUCX6+5aSBhlbwk2lV8SNu5m4WCuxJsQpKb78+w5 8aR7YnGn/Y8hA2LZUvUxremnyBZvapBbqqzF3/+WWDHn5zU6qLVl8AsqKZZg= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6808:309d:b0:4a4:65f4:b54d with SMTP id 5614622812f47-4ab6a1e399emr1234582b6e.35.1784952568428; Fri, 24 Jul 2026 21:09:28 -0700 (PDT) Date: Fri, 24 Jul 2026 21:09:28 -0700 In-Reply-To: <6a4fcd58.a1ad617e.25832.000e.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a6436f8.073198cf.94f0f.000f.GAE@google.com> Subject: Forwarded: [PATCH] wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie() From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie() Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci The KASAN allocation trace shows that a malformed IE buffer is stored via SIOCSIWGENIE (cfg80211_wext_siwgenie()) without any validation. The crash trace shows that a subsequent SIOCSIWESSID triggers a connection attempt which calls cfg80211_sme_get_conn_ies() to process the stored IE buffer, causing: - An out-of-bounds read in skip_ie() which reads ies[pos+1] (the length byte) past the end of the 1-byte buffer. - An integer underflow in the memcpy size argument when offs returned by ieee80211_ie_split() exceeds ies_len, causing unsigned subtraction to wrap to SIZE_MAX and triggering a fortify panic. Fix this by validating the IE buffer in cfg80211_wext_siwgenie() before storing it. First reject buffers smaller than 2 bytes since a valid IE requires at least a type and length field. Then use for_each_element() and for_each_element_completed() to verify all elements are well-formed. Return -EINVAL if validation fails. Reported-by: syzbot+cc867e537e4bd36f69bb@syzkaller.appspotmail.com Signed-off-by: Deepanshu Kartikey --- net/wireless/wext-sme.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c index 573b6b15a446..95180579e4f9 100644 --- a/net/wireless/wext-sme.c +++ b/net/wireless/wext-sme.c @@ -319,6 +319,17 @@ int cfg80211_wext_siwgenie(struct net_device *dev, return 0; if (ie_len) { + const struct element *elem; + + /* IE must have at least Type + Length bytes */ + if (ie_len < 2) + return -EINVAL; + for_each_element(elem, extra, ie_len) + /* nothing */ + + if (!for_each_element_completed(elem, extra, ie_len)) + return -EINVAL; + ie = kmemdup(extra, ie_len, GFP_KERNEL); if (!ie) return -ENOMEM; -- 2.43.0