From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796452397; b=Ix7Dz0FVWCWz+ETaOS/tCaPN/8qicP3QVr1jzmLyyUP9wy7zyPNxImO/OWOo73dUJV+u bXwX5v75iQJ7LKxIvNER3kI7h6054O4fAKer5P+DZTOwesedv5c1mjE/rH1mCBBt9JOzV lCy5F+NV2PJQE1cbZZ/xbDIqNx5xI9eP72A/nqfYa6yKtGJJxFSkl6R8kIQGasm9DxRBx r/Vna+Ss03r+41nwp5JMwKNAQHhJ1HzYwCwpuO5yByzVY90xXybdtEBKTRGKNUkf5SeN1 CNIb/Q/SsLtXIk33LyvCqdKZGU9xGDAZPrW9uvZQ8I99ZomoeoKCB9CY/VMCO0H26jQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796452397; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=8JuYU4MEYDCRZjkSJ7brK8HwdzYzvtXEoJHK0t0Bqnw=; b=MEDZFthbEXHXz8t80pMd1NHxQErk3o4/5f41HBp6rFI3flYRxbCG6w2tS5xyLtztbXE3 GTmrsJRTCrzphZXAKh0cgwtrwdxI5aBE3rKE8veHCoZNMQC9onKTW+RqNASuhm7xexF3X sV2xbRfkN9PUCgPnb5XOUu+60jLiXskwlakaytedAeykhBFsiQ2vj7Lr/aiJ8OxPZ9Ua9 xu61eRIpmz42+QFnnMcC948Fcu6/lGsn7UECPQMC1a3FdNeZ9lmxKNScs/dNXxaS3qcEB B7QLSFc2SrNi9saopkpkFur5craR9LwtA8TL59aiOYtrZcbAzszhzGjkD64IKfkKhbA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=UcTWkziM; arc=none smtp.remote-ip=74.125.82.51 Received: from mail-dl1-f51.google.com (mail-dl1-f51.google.com [74.125.82.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2625B606A6BE for ; Sat, 5 Dec 2026 06:33:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2625B606A6BE 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.a=rsa-sha256 header.s=20260707 header.b=UcTWkziM Received: by mail-dl1-f51.google.com with SMTP id a92af1059eb24-1b5d60183f9so2080415c88.1 for ; Fri, 04 Dec 2026 22:33:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796452396; x=1797057196; 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=8JuYU4MEYDCRZjkSJ7brK8HwdzYzvtXEoJHK0t0Bqnw=; b=UcTWkziM8/uhpwJpWr9bvVETLBZAua4Gs9AH6Lq+kHpVa99llEaQFztG03ER7PjN/z t1MAmp0wAqrHNA+SzirmXbih59arxXz/KXj8RqBuqbjHvA2Jhet38S3gK1GH2NNgUnAk rr35QHibbTJVwyu3U7QVt18Xs0lcyx8Fh18KNIo39saJ0/o8qMV1kM7KHKfK31S2KxNA 5eXyEMNDBUhDp/wpNLtK53XrO+h5fhJQKkqacK90yfgHGACHq8PF8tdAK3WKe1RKlVxX LLOFxv3OCxICObc0sxhEKgEfepKKstWbRmn5ijo/o8PzaoY9CixOF8AOXWykbl06yKbm nyxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796452396; x=1797057196; 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=8JuYU4MEYDCRZjkSJ7brK8HwdzYzvtXEoJHK0t0Bqnw=; b=MwmX2n/qUb6dUW2JH/nZUQIQUKiZla/jku85rlvaYI6P9zdD8fjfv4mI3cJRXk050m +30jPudSBKUEQiDbOqkiw6ud7tCbUjCvz/NwFUWPwe7NB2Cwx5JJqwi+1viUX/0Tt0Zh wPKn7BDhzcdwxS9hYQVb4OzOAGPWqRZ6yIKEMBEQJ74asG5ztJbDMt5m3ciIMHx4vDjD 9pVhJX5jlWJN+XV03e0C+yDDcilEd9Is+gO41wdOABJuB1KAeb+d9mFdqHhoF5e3SR0F +Jze8jIrz9SZ6il8CmU3O39wV7hCJO0y1+zbxlKXp2Aq4ZmccsbN1wZRlFS1+9Upa9vJ 6kuQ== X-Forwarded-Encrypted: i=1; AL+hErGEJmsP9MMLeUJKIikp57GMZMSLCk4A4/YftsEUpmG3poSGZTWkv7IXCC0qchsQ3F5Kz7Aj+z8QaxI5@vger.kernel.org X-Gm-Message-State: AB4q+uHB2kPXi8c9YkmUrkwvFgo0YZ/QlkU+He80aHe0BtX94TNDpLtu 0E0TcxvVzX/RezQuvhdk8Gn92oEBYN33lHdnpeXwdls9/e6g3f063/BPZaFAUA/r X-Gm-Gg: AZFdTZdFyo3PoGwK/qdv0ZOTricGu5bmMDu6Pp2NRUiHZpTK5gdwYdAJkSy/Gf29Lbd 9p4Wq14VIe5M2u+1SpQLltkOMZmpBsjF4wHQv5UwleLXAu0tj+R4t3wXSi+RTs69tXI6+07rRZt Ee4yAes8x1fCFDxEaj43XdiDigKKwdLtOkxM1zRLEMqC6AgOOqZob4b+OsaVl97dCBeFXmKjVL8 gyrEVdgAdKr8PsVAyQdUglHwoIFQuYV6uKQgZh0UERqxHHnN7SZV41Q6MbMNtJK6aBG4Tu4jV51 DGWzxHTWIrXn3kqxCeYos0CVcMnTnSwrhIpCQed1qf2ctEo3foUi4LjIYEJFd82EyBxaeptmGVu 22twA7BygNH7aNeFB+1B0WTlNH1pCGM5X3uN2kkj8/cAt1cjLCC+igg/MgYj6jrCLxwBCJTSthu O/kht+f2B1051j2hLVYVmJxxi9wk/fCfHO+ywfDoqnhinoHSjo/GLsSefiW6Gwvhd44DO7ngQt4 jQJ16ZErqtn3RnUVFIM75VNvuqwGU1wg4WxaFHGKbwJECn8LzNgtJU2lnZw85Gv/1cfRGrNcksr 8cKoQHtTdRGZY8Ak5V3hsDobE6Ry4JQT4BjA8ukgy6n6jAt7wXk1skOm37tGJMw6bAY= X-Received: by 2002:a05:7300:cf87:b0:385:4608:5679 with SMTP id 5a478bee46e88-3875217d82fmr3871804eec.40.1796452396295; Fri, 04 Dec 2026 22:33:16 -0800 (PST) Received: from localhost.localdomain (wood.seclab.cs.ucsb.edu. [128.111.49.37]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-387521bb842sm14612341eec.15.2026.12.04.22.33.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 22:33:15 -0800 (PST) From: Praneeth Balasubramanian To: Brian King , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Praneeth Balasubramanian , stable@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/9] scsi: ipr: Skip dump entries whose length is not a 4 byte multiple Date: Fri, 4 Dec 2026 22:32:24 -0800 Message-Id: <20261205063229.2518424-5-praneethb2002@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20261205063229.2518424-1-praneethb2002@gmail.com> References: <20261205063229.2518424-1-praneethb2002@gmail.com> X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ipr_get_ioa_dump() takes each dump entry length from the adapter dump table and passes it to ipr_sdt_copy() without checking that it is a multiple of 4. ipr_sdt_copy() copies whole 32 bit words but advances page_offset, bytes_copied and the dump header length by the full byte count. When firmware supplies an unaligned length the trailing 1 to 3 bytes of the copy stay uninitialized and the next entry is written at a shifted offset. A later read of the dump sysfs attribute then copies those uninitialized kmalloc bytes to userspace. The dump is only readable by root and the values come from firmware, so the impact is limited. Skip such entries by clearing their valid flag, matching the existing handling of entries whose length exceeds the maximum dump size. This was found by an LLM-based audit that checks code against the rules stated in kernel comments. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Praneeth Balasubramanian --- Notes: This was found by an LLM-based audit, part of research at UCSB SecLab. An LLM turned a kernel comment into a rule, and three LLM votes checked the code against it. The fix and changelog were drafted with GLM-5.3 and checked against the source with Claude Opus 5.5. I reviewed the patch and take responsibility for it. Testing: builds without new warnings with W=1 (x86_64 allmodconfig), clang 23. checkpatch.pl is clean. Not runtime-tested, and there is no reproducer. I do not have this hardware. drivers/scsi/ipr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 1a5e362cccbd..71a70ce59bb2 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -3173,7 +3173,8 @@ static void ipr_get_ioa_dump(struct ipr_ioa_cfg *ioa_cfg, struct ipr_dump *dump) valid = 0; } if (valid) { - if (bytes_to_copy > max_dump_size) { + if (bytes_to_copy > max_dump_size || + bytes_to_copy & (sizeof(u32) - 1)) { sdt->entry[i].flags &= ~IPR_SDT_VALID_ENTRY; continue; } -- 2.25.1