From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (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 70AFA26299 for ; Sun, 28 Jun 2026 00:05:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782605115; cv=none; b=ihdsdYk5RSxcXOlm46dSQeWdcl1WmlI3h5Tmwo+ugrSFHiFrb3R2O+zL29L7qxOBbvlQK65kWGeBQL9i+Pb7Q160mBztSwUm5tiVhKaqcpp9FVcpF0G4Ce8VCnjmjGy+ls6tOoxsay6SwbiENqiKuqQmseXIuvmIJoIBQhkwGSw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782605115; c=relaxed/simple; bh=FB5wGAqoS2bX2ASLy/sBczt26iL9deLkDzWEdROLpMo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fWc7debZYhYJavvP96EjDBLCs/8VcHQDfpHDGhDUODuBMja8dzf5m8UPUbH4TDgVDNk9ZhDeI7K0B7Odu8b1GTBwxeXEfoDE098pVr1iwGvDSuvcISn6jwVVqpH14F5GBugbRf6Zxjqp9sytKKY01PyYuAWguOYwweE5bnwrNzk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=asu.edu; spf=pass smtp.mailfrom=asu.edu; dkim=pass (2048-bit key) header.d=asu.edu header.i=@asu.edu header.b=lWpKw3iq; arc=none smtp.client-ip=209.85.215.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=asu.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=asu.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=asu.edu header.i=@asu.edu header.b="lWpKw3iq" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-c85c531d4a9so874219a12.2 for ; Sat, 27 Jun 2026 17:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=asu.edu; s=google; t=1782605114; x=1783209914; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=okD/Agid8Qwsbynaw3O1TDujT2jmme0nOePqmfn3oMs=; b=lWpKw3iqh7u1zMHdTXM1s2M8r3eeHqvY0Z5rLJvYcHplCe/OTI9tibCGWf10+n7Ceb ++WeXtYgo4II873VT2yLcXQG9llELW2/Eef305Js/DAFe2LrVICe6mRptSg7F9cSHNqj tza+SOPZOcI9j6TWCRrSGFW9zc8H1VeVFK6bqzJH1Txsgx1M2JO/zal3no3130QYP/5i aGJYeEC4/oPN82oPNtSHlN+DKrAZYJ2lOWg49zwYzHAFKxMEk/b3b2VLE7mBHyDwETJV MBPjr7wc3xxWtbwJsZZsfZ15hM+3VVR9994iXEMBkani/JxQGvNrerf1N1qVxA/1qaqr gBxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782605114; x=1783209914; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=okD/Agid8Qwsbynaw3O1TDujT2jmme0nOePqmfn3oMs=; b=HICvPZe5k0jhaNK9kokcp5lkgAlX8BTGX6bimtAdxer4Yizw4kaxw01gPSpd3wBKhK zwDXdqWgiQEU+NUsugnHjln4LJ3ZoYBURFLhxzvlCeLlw9W9Q484ZdUNoxq32m7/eJoa CMgsV9BriiIp1CVqcTZgMsWtr6ryAnpYJzPQr6QCAKl39oqmho/9JtoTUocKTR0sEi82 TbGhEEk2/cDKqpWRU7OAUcvrZwzvCCpHK7usnaycDgz96PGJXOBxhIL7hoK3/nq4Kgog oT1GpJynvPf9iI654C7xwJTO/owv0My7eg5xYmJPU5FjVP4UdViAabH2g+v4MvDRcfMT HN4g== X-Gm-Message-State: AOJu0YzDfnRuOzqf93c6Ecni5PvT/Rmhn45O4enTHCBT3i7q60NgOCYG iv2oa1nywupguV/3oAH79abxX1JK1z9EwJkeEon1WbSpXVzitayQQMs+3TRhciKVIg== X-Gm-Gg: AfdE7cnGOOliRCcHwxYtqNNCdpTK2obfapSj8U+hZW2r11ls2hYkwOFLxmjrIKyHaOd fXtwi7MlCqBg8Le3gfCYBg7JuG0Dg/1RiVJb2dLOTJglZgArGnNPPlUX24f+jn1ycc8YBVPNgOF egRnRC4S2xeDFoN1W3A5VLkDWo6O2ryVZ/8qms9AE9jmnNFihIyErLveDI/uJuT6TG5AjUV60wl DZnubZFMAoihE6i8s7dn4qHFRe4auQQv86k4lyO5EOEirUYyzmSf/MIHo15Pv3yJb3rGxEqmpAm s3Kp9LGmCzss+0aTKS4gV20YQPEsrCVJdJPIC0jNoAugH1rusywtlJzTmp13Xn9RqkhDNtNY8sJ f/l2i3az+GLXuYfCOqpclL9WiPlVKZd5Cqwz7xxmW+r0eSQa81q/ECmBiJJqKzB/dt85mHwc0Fi J9NEfZV18WVg== X-Received: by 2002:a05:6a00:1382:b0:842:2419:6bfe with SMTP id d2e1a72fcca58-845b39a255cmr15532331b3a.7.1782605113558; Sat, 27 Jun 2026 17:05:13 -0700 (PDT) Received: from p1.. ([172.56.108.113]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847702a9d70sm79900b3a.20.2026.06.27.17.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jun 2026 17:05:13 -0700 (PDT) From: Xiang Mei To: Christian Lamparter , linux-wireless@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Johannes Berg , Arien Judge , Lachlan Hodges , Weiming Shi , Xiang Mei Subject: [PATCH wireless] wifi: p54: validate RX frame length in p54_rx_eeprom_readback() Date: Sat, 27 Jun 2026 17:05:10 -0700 Message-ID: <20260628000510.4152481-1-xmei5@asu.edu> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit p54_rx_eeprom_readback() copies the requested EEPROM slice out of a device-supplied readback frame without checking that the skb actually holds that many bytes. Commit da1b9a55ff11 ("wifi: p54: prevent buffer-overflow in p54_rx_eeprom_readback()") closed the destination overflow by copying a fixed priv->eeprom_slice_size (and rejecting a mismatched advertised len), but the source side is still unbounded: nothing verifies the frame is long enough to supply that many bytes. A malicious USB device can send a short frame whose advertised len matches priv->eeprom_slice_size while the payload is truncated. The equality check passes and memcpy() reads past the end of the skb, leaking adjacent heap: BUG: KASAN: slab-out-of-bounds in p54_rx (drivers/net/wireless/intersil/p54/txrx.c:507) Read of size 1016 at addr ffff88800f077114 by task swapper/0/0 Call Trace: ... __asan_memcpy (mm/kasan/shadow.c:105) p54_rx (drivers/net/wireless/intersil/p54/txrx.c:507) p54u_rx_cb (drivers/net/wireless/intersil/p54/p54usb.c:163) __usb_hcd_giveback_urb (drivers/usb/core/hcd.c:1657) dummy_timer (drivers/usb/gadget/udc/dummy_hcd.c:2005) ... The buggy address belongs to the object at ffff88800f0770c0 which belongs to the cache skbuff_small_head of size 704 The buggy address is located 84 bytes inside of allocated 704-byte region [ffff88800f0770c0, ffff88800f077380) Check that the slice fits in the skb before copying. Fixes: 7cb770729ba8 ("p54: move eeprom code into common library") Reported-by: Weiming Shi Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Xiang Mei --- drivers/net/wireless/intersil/p54/txrx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/intersil/p54/txrx.c b/drivers/net/wireless/intersil/p54/txrx.c index 1294a1d6528e..9f491334c8d0 100644 --- a/drivers/net/wireless/intersil/p54/txrx.c +++ b/drivers/net/wireless/intersil/p54/txrx.c @@ -499,11 +499,19 @@ static void p54_rx_eeprom_readback(struct p54_common *priv, if (le16_to_cpu(eeprom->v2.len) != priv->eeprom_slice_size) return; + if (eeprom->v2.data + priv->eeprom_slice_size > + skb_tail_pointer(skb)) + return; + memcpy(priv->eeprom, eeprom->v2.data, priv->eeprom_slice_size); } else { if (le16_to_cpu(eeprom->v1.len) != priv->eeprom_slice_size) return; + if (eeprom->v1.data + priv->eeprom_slice_size > + skb_tail_pointer(skb)) + return; + memcpy(priv->eeprom, eeprom->v1.data, priv->eeprom_slice_size); } -- 2.43.0