From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 458A933F59D for ; Wed, 12 Aug 2026 19:05:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786561561; cv=none; b=AGLvhJgCxrSrudazwEUtjJ7RgBttvFFNTL9goIhWpkMHWDDyOHMaMXWRq691uaZUWKFE1mrpR5izVsNQ/Lt0F/dMGJiZbru8tJ8f7+nFuWx5pF/iOFqkI+OcL2Px3DMOSIHygE3LalbKpyGut7NqfOfCsfK78//+50JhUn0AMLA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786561561; c=relaxed/simple; bh=eQp8XVqRjvd60SUbMt+7dhshdzEr9vsuv1ssHGoq5HM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SfEZAHBYk++2QELrtUZbWyBUKHXdnuteLMDRpXeSh1W1fTh6kXwBGdubyd2p37X9VJQxqMZRrLs8LQDPl5y1mxk3QFnISsV7aC9RLD66H3ldnopYxsPcl/GL4E2FPCsWgYE0kDp2eievS9hjQbuPRLz7PB7r4AnOdjBubw9liX4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MEYFVEFO; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MEYFVEFO" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-476a130c138so1084471f8f.0 for ; Wed, 12 Aug 2026 12:05:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786561558; x=1787166358; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VfMnRH4aX6HLrkbz/tRyXORgXHNB5l3UhNoONEXfJJI=; b=MEYFVEFOsOhn28YdReysg9cEPgapDU4qhiBTKkLuaaizeMI8xhJjgdIiLTlUVEBEOb XS2CV7A3iFdsrwIK4byFRq4uWC0xkp6ghOvean61pEeZ5l/bbKkA83qsYLX/KzMXtIVL QdyFzJbz+1Va70dweidd8P0vh82VF+L1TbXDFBQGy9l6SW7E6sd1GJnln0be4Z/L5wSX iLkaYlLt/CVHPLOFO/6LoMqSd8gLMtdJNTtdrUZQj7KeekWbEZ8BJCnplsIK7FJ4ycyp 3ercN+k1/4MBpXRIw9mswSjojlBMpk/VIfxb47l5loRrOESBI09vXHvf/QQx3XtRYidh atzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786561558; x=1787166358; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=VfMnRH4aX6HLrkbz/tRyXORgXHNB5l3UhNoONEXfJJI=; b=aUsRfuSDrekJduP4S0eD8H/UxYjDgDqFjSc1MSeMImhnVCUj/7OwsFUnaBCq4yjoK4 dMNdOL239Nmmh4GbFh3Ac7MBZwOi31JnVT4eUxd0N23HO7wia7xaJryrqO98eYHA0tr7 4XfaG8is+WH0P9+fl7v/sTibMl833b4e+sfqWQe8an/vvH6ximcLNugQqpZQ1DOogVfp +7ynBX5JJ4NwcZXtAN8SZAbnIpsNVCnYpb1wYhuTI0VatdMGB4ORtO6pWUxmqxEVgxyr q04b3dgKIec/KrRnu4R6PKSwIOcJG/NLWok5Nyv+uiLb2pqZHwg/EGocDf6esS2KMokn mwpA== X-Forwarded-Encrypted: i=1; AHgh+RrrTESfZ07TmV/GHV+oD9DI560uF1lfxpHMLVhL5DNgEBSRJ7AbINTq41r2ir7tocCHtVwzA6k7G2uhtgU=@vger.kernel.org X-Gm-Message-State: AOJu0YwKhHBUpNvzwix+6KcYD7nL7b/HZ8AIkPPSG/OKgYFJ9MrUuud/ TrBX3qU8TGiH/i/ohxFMZHbS4IxVL5cIIC5zWtSnVNpHaJMY1N3YUaT0 X-Gm-Gg: AR+sD11bBr7TkfxkAU6CSDYUpN8fTHPtP2wYKynNiI8DU1cu3tZKfEdqM1VR4QUtly+ MI32zor2mrwNuPwELGKA4xAoIqejpWbHFEbJUzPK4Ab69iXXNfynFPVJcWikz5MVN4btxRLtRO/ egR2TxJD5yO3lvLR22nVpem/VOhbULMW3EzLTUfH0o+7YYkN63/LZZDE5oHr6DSLtfD+yMZC0fk nuUH248wiBMeAOFjINp1TrKyRaMUXc/nfRKnXl24Utd2MAkG+PxxiPiBlI4q9OGZVJuQriqS7MA XwSHMe4z1/2nWxtsCh0v9V0vUE8aCAE9kBxLd4ULWTm5s3M5rNHoUuKwuCGKZhHSmlV6iRLclyj a0wgHv7EG22mCfcpI1xVMwxWLbUVEVIUS7cHGJXZC5CFb3wPACtSo5MClHEqWRchh6JcBh6bzgN Ib2BqfOUdX7r/MY/mazp7WiSUn63/nryP6nHXT+VilFUR0E36PB8WL/wTXZnqvplWPx7ADJIMMd azKHiI4CSlyFA8WYVllOeMtR2hn6uc9dkCugpyETOs3RnpShfv801X2DYzhBs42kfYUEyASg5F8 sZ1J6g== X-Received: by 2002:a05:6000:29c2:b0:47f:71a6:970e with SMTP id ffacd0b85a97d-48159c8da03mr411377f8f.2.1786561557974; Wed, 12 Aug 2026 12:05:57 -0700 (PDT) Received: from Mac.home ([95.35.242.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48150d5eb2csm9179875f8f.30.2026.08.12.12.05.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Aug 2026 12:05:57 -0700 (PDT) From: Shmulik Cohen To: stas.yakovlev@gmail.com Cc: johannes@sipsolutions.net, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Shmulik Cohen Subject: [PATCH 1/3] wifi: libipw: reject too-short beacon and probe responses Date: Wed, 12 Aug 2026 22:04:10 +0300 Message-ID: <20260812190412.18333-2-anuk909@gmail.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20260812190412.18333-1-anuk909@gmail.com> References: <20260812190412.18333-1-anuk909@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit libipw_process_probe_response() and the libipw_network_init() call it makes assume the frame contains the full 36-byte beacon and probe response prefix, but the ipw2100 and ipw2200 receive paths only establish that a management frame carries the generic 24-byte three-address header. libipw_network_init() then computes the information element length as stats->len - sizeof(*beacon) stats->len is a u16 and sizeof() has type size_t, so the subtraction is evaluated as size_t and wraps instead of going negative. Truncating that to the u16 length parameter of libipw_parse_info_param() yields 65524 for a 24-byte beacon, and the parser then walks the receive buffer as if it held almost 64 KiB of information elements, reading past the allocation. Reject the frame before any fixed field is touched. Found by an AI-assisted review of length arithmetic in management frame parsers. Verified with a KUnit case under Generic KASAN on arm64 under QEMU; I do not have the hardware, so it is not tested on a real device. Fixes: b453872c35cf ("[NET] ieee80211 subsystem") Assisted-by: Claude:claude-opus-5 Signed-off-by: Shmulik Cohen --- drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c index c8841f9b9ad9..2661dac6985e 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c @@ -1421,6 +1421,9 @@ static void libipw_process_probe_response(struct libipw_device #endif unsigned long flags; + if (stats->len < sizeof(*beacon)) + return; + LIBIPW_DEBUG_SCAN("'%*pE' (%pM): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", info_element->len, info_element->data, beacon->header.addr3, -- 2.50.1 (Apple Git-155)