From nobody Fri Jun 12 17:18:12 2026 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 F05AC3EF678 for ; Wed, 13 May 2026 15:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778686505; cv=none; b=E9O4mnjRynesqlgCsH9iVdu6zNRUDRykuWZlRhfQVybiLtv9+lFZEjgjzPUX5QF2aZRX/xloqD/MqIo7URMmJxlI4GLiDksmoqt95ta2A2uoeTKfHgc8/rpw+/sE4HN3ruAU0Pzo2T+HG64Y1tvzwI+al1fqiLyDR7/ZAxCrq2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778686505; c=relaxed/simple; bh=380OIoxziQ8FlKx1mJdOpqZlW6QTVqBF+ru5RUN6Y8U=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=cWueL6Gk8VzIU7sKuUsl0zs6jBM7JK09+jggXhPTRaTwnbWtx/5quGC+xs0DNCgMy17NQUbJk63P2IV/ZsKqI2ag2ID3N7wC+lAtXFIUSzT7BlCTZymj7j/5xt4pQT+3nf/FyynuSeC1dDiUPas1WLmJfjv0gX5BIVL3HuC2KoU= 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=npRkMkoU; arc=none smtp.client-ip=209.85.214.169 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="npRkMkoU" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2bd2c147abaso7167275ad.3 for ; Wed, 13 May 2026 08:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778686501; x=1779291301; 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=1ruAzbMeVdqPrvuygkIYeYyoYSoRcGERUW0xC+xQv0o=; b=npRkMkoUGnX70IhNC8M/ofOyKtFVwAiVdmWCIefbzRBhb9ApUHkAZn/LSblKzBFCRA wlOTJp3WKEN6cxWpj32fSDOxvmJSFeTaxHXGELTCZkENr8/dsHQWW/BOJoD+RiPc4Wcn ZHiMizZfcam6yOMHqJjLkpz1EZFQxJlQNPObFaG3u+1Gc+WXSMhmbCySzPER2zv5gqNz 0uWCMkz3b/u06VCJzxJY4G4G/nJghKTash9R/knJHy53JLg5TKFtcJ2Hdt+pZs+3b3bZ +pv541wOv/ki2bCzgMngHRTw55QDIm5EekSXN0fiV8dWHh5YU5mK2PsXZaii7QyhbjRg KZgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778686501; x=1779291301; 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=1ruAzbMeVdqPrvuygkIYeYyoYSoRcGERUW0xC+xQv0o=; b=h6T0nDtbcz5+DrZzA0gmMsvk/EMtqATTrPA/PQvd9ZfGbkzAVV0gjHg2nYrJDWBWeB V5kqHz7dDJzZ/joXg42W6BZKvl1bsN/Bg6MrwYfyQDd/D23ZzPoe0kixyhTQS1PbFj1I hggtgqkliIlv0rm6IOdOr8LZhdMXFBUsRLfRuFCrHzofvvSNsKnqIn8t7hCrA99NHWtx iJ07LEtCk6hTZf1D+j8L+2/vVierpOgxtYli3jvZWSqTl8HlIt6SYKTWx6UfswC5Gdla dkrPSGpld2j4ChTg0nypnCpQNZa4Rd1NNEKwuqwsG3QM9kiIl+8UbaCdIB6dSlt6eOG2 D3tg== X-Forwarded-Encrypted: i=1; AFNElJ9C7QCVz4J8GB5bJFQjpJMrdBUfq+3dadxHlhyTwSwM4/GrrRgoUakT9neeTNyf7M8DhY0W0Ko+ZY2mPE4=@vger.kernel.org X-Gm-Message-State: AOJu0YxNHFF28cByr1PAn8/mp+M3Qg1wWMs7IKGl9q1JaqqWA+Pnp+n3 ROoinW1puQScTnUitoqkxXm0SVaFQNLFZyF+EhFrI4mUUnvmt/OtUQ8u X-Gm-Gg: Acq92OFBUvV/Hvof6ay2gj/PA1wsYThWdkkE5pHNS4JksLhd9/aG/YjsPnJA9z+sPhl Si+/YMQO0ly3/MqRmRifSVb2uP4+5PQulh6IimjpTQscmTbWcdx1TrAQazW3m5+GHE463Fa3c6j c4SE6kQ4PuEBoXzSPrfIMtxQCDCH1EGxB2fmXP0pDyB+QnUnb6gDYaiHYsZr93LOJmSOz/IUxJK S+9Lyv0ZKAieb/xXnq6S4uHfagV0u9m+Ct7uTFGqP5Abm8SAHF7pUbRH/U4xapwL8JnSD9phqgj 098Xk9VMOOZeWFuJ0nrHQhinV7Yx5LdsVo93BZxzn5HIPYqh/ZavSS8LPm37nUnngA33Kf1zmQE BPVq+c8P40qDSv4ZfCzMgZmXxh3TzASRNiYDDoCFul0HkjwfDZRl8onQfxIH7/lb5/vsH0dGwAb LCUoXdwaIK8WfJxfdgbV+A+1La6rrg/eByKZmRRbuoBMhdAwnKuulo9vRsXMj0Ig== X-Received: by 2002:a17:903:f8c:b0:2bd:147d:c712 with SMTP id d9443c01a7336-2bd27133c75mr44261705ad.1.1778686500924; Wed, 13 May 2026 08:35:00 -0700 (PDT) Received: from localhost.localdomain ([115.110.225.242]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2baf1d27055sm173821065ad.6.2026.05.13.08.34.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 08:34:58 -0700 (PDT) From: Shitalkumar Gandhi X-Google-Original-From: Shitalkumar Gandhi To: Alexander Aring , Stefan Schmidt , Miquel Raynal Cc: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-wpan@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Shitalkumar Gandhi Subject: [PATCH wpan] ieee802154: ca8210: fix pointer truncation in kfifo on 64-bit Date: Wed, 13 May 2026 21:04:12 +0530 Message-Id: <20260513153412.1284549-1-shitalkumar.gandhi@cambiumnetworks.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ca8210_test_int_driver_write() and ca8210_test_int_user_read() exchange a kmalloc'd buffer pointer through a struct kfifo, but pass a literal '4' as the byte count to kfifo_in()/kfifo_out(). This is correct on 32-bit (pointer =3D 4 bytes), but on 64-bit only the low 4 bytes of the 8-byte pointer are written into the FIFO. The reader then reads back 4 bytes into an 8-byte local pointer variable, leaving the upper 4 bytes uninitialized stack data. The first dereference of the reconstructed pointer (fifo_buffer[1]) accesses an arbitrary kernel address and generally results in an oops. Use sizeof(fifo_buffer) so the byte count matches pointer width on every architecture. The driver has no architecture restriction in Kconfig, so any 64-bit build with CONFIG_IEEE802154_CA8210_DEBUGFS=3Dy is exposed. Issue has been latent since the driver was added in 2017 because it is most commonly deployed on 32-bit MCUs. Found via a custom Coccinelle semantic patch hunting for short-byte kfifo I/O on byte-mode kfifos used to shuttle pointers. Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver") Signed-off-by: Shitalkumar Gandhi Reviewed-by: Simon Horman --- drivers/net/ieee802154/ca8210.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca821= 0.c index 753215ebc67c..154af346c936 100644 --- a/drivers/net/ieee802154/ca8210.c +++ b/drivers/net/ieee802154/ca8210.c @@ -597,7 +597,7 @@ static int ca8210_test_int_driver_write( fifo_buffer =3D kmemdup(buf, len, GFP_KERNEL); if (!fifo_buffer) return -ENOMEM; - kfifo_in(&test->up_fifo, &fifo_buffer, 4); + kfifo_in(&test->up_fifo, &fifo_buffer, sizeof(fifo_buffer)); wake_up_interruptible(&priv->test.readq); =20 return 0; @@ -2541,7 +2541,8 @@ static ssize_t ca8210_test_int_user_read( ); } =20 - if (kfifo_out(&priv->test.up_fifo, &fifo_buffer, 4) !=3D 4) { + if (kfifo_out(&priv->test.up_fifo, &fifo_buffer, sizeof(fifo_buffer)) + !=3D sizeof(fifo_buffer)) { dev_err( &priv->spi->dev, "test_interface: Wrong number of elements popped from upstream fifo\n" --=20 2.25.1