From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.175 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796452397; b=rpu+NnxI/WiRPreWF2hGw0/9+SmoMOJ6cm0UsgnL/mqnxKVSBzjm5vFJhivLb7RB1fWu O6gidE3iH5LyrnqR+sv/nGRmfk+tSny9lw5nMRTG0zVrk1N01euglDAY+QXv9+A1neCYX 7WMzAcRDWwhRNF9Z6yvobAU9Trx3YlvStXib7/K407PK6xFCSH7rG0BbaNf+b7jcwSFkQ BemTZW3sApTJ6PSHBTRHlw6IigrI+Nf2ZX0UxB/guRnDVCFk0xAGZxJRgAxKCA39gdnok N2jODqqZkZWczovudRGCsN8Ua1TJw0ct2FOvSBaLSAQuCN6Hby5bccMqeYiAWbWnfmA== 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=JzUQaIZi4Q/KGXQdh2dNU7B9r0q6TvuzTRL9LSD/7KBZtNjiLT8aeAaV9SJvkgQ9pres V3CvVGd/DueVhs9rk7Px3lo9szNdvpHHkWpz0jYdTLVcWw4tcS0tdkO59aOMRF9avLj29 VCEiAcpvN+h12vJUiDRHL4DfLVX4rkwJ1XG6YvBgXLE6RJjLRCLCUmBePSB3enQ2XPSEh S5RNu2kjKZlaMZtv8ZBJ5k3L8gYihac51BLpNMcCHhz09aGnvP+V1nksbGzcI1zHeRlyk mkyxIXokWLy5OjJeF2PsQqIHTTY5bELpnPsJisR3I5RCPQTdJ+VaLsm6twKMpY3OnqA== 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.175 Received: from mail-dy1-f175.google.com (mail-dy1-f175.google.com [74.125.82.175]) (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 251FF606A6BC for ; Sat, 5 Dec 2026 06:33:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 251FF606A6BC 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-dy1-f175.google.com with SMTP id 5a478bee46e88-386ab9ab619so2758685eec.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=BlgwRjkBDiEhS10CM3Lcnq192QNkmKIHthqGI6hR2nEwU675YuIFmDc6aUAlfi4ZFx RfwAX2Di7BcVmxMwSVq//BLV5XPRBJIiyotnVo824r6Uk7Q7Kc1BBA2ncOwFGQeCojbz ej1D0RjqpBcIZ/a3vySNgj8lM4WHowxIx5OYW6hBmz15SlDc5mqrXb6J9CgGhceg9iRS uiUy7SNbtZ8KEBQChjuqcBJ928D+O98DbG6QIDK8fAf+C1Ig8Rkj28AJ1CcmBGA1s9Bq 5LbFzO1yh8Me8J1UUjovxPeGkQbUO1ryS/pQqPDeuSF+lIGd+4Rp6L4jfVkXFs7lXQ2p onDQ== X-Forwarded-Encrypted: i=1; AL+hErH/0MDJV9ERzmLcwLbt9P54CJVLsZe1gdW/ZVihiKpOm79UiNtfOmAV+kkdPXcKpSbx3YP7e20=@vger.kernel.org X-Gm-Message-State: AB4q+uGRw1p3SDma8Dj+dMTm4lHO1CTQxqeYbkWSXbBRk/M3pWAlQ8IG LlCk5cfml+p+PAczgGbvVprRg8sqiLNlR1XqFnAHibJN/6BKnHh4uSOK X-Gm-Gg: AZFdTZc20M5J89RNY5SpmPWJTiLBBuTNwSihOSewMEiykXBbpeUBkepfEWOFAEEJlhg IuaK9nrMUuaV1+8wlpqZQNib3PpjjWUeRBgmDQITOcRe1YaGGMxeHOCaVWy6LnV4DhJ7hutSWpU mX1uyhOxnkMbTd/W0dedc3jYChaKXRaoab2Ykj5ZSkhNgEcf1ikCFy2vtwNSFGnEZRbniK9DWCB UoYRPOda9zf9ROn2xmfQOw5w4HiwmNwjUkOc0DK1ano+bGuxUh9zsuiW/31FVLN4ryhKHKrv0gB MITaFU6sobYeinHBs8QUJnwcK1GvqfqvqL+vqe9gMZcW9RdPypatd/ym1p2BYmtyAkLkfYWeHNl hD5hbT2YtQjcHg6D8xN1gqnxfEoOulr7GD4yXDiDawo95Y2KWWipAQnzmJ9Kso8R+jsYpSp2rrS g28rdVgJj9Pyhi+BCDDP9wofPyqITcUY4DhlKKJ24TE9bHQrgeEt6jNsr4rbKkFEgPqDsOo6925 fNZSzyU1UJgmFUzju/nGHpbWCIFZ9mviGw/dTlfICOMg2TCbFBnx2kfhRVyH5QQ7pW4+Ld+FvW5 vo/j6WciUCZxPzippK1RBm2wNRl36iIjyHMEUwmj8O60UuDv4ImFsZaZZ+ENLJw1Fvc= 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: stable@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