From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.180 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796452398; b=SXuYOOoq6LEM1XDBSGMSgcvgnjdK0e+l9q7Nyuzb96/5FPTJfioaT5UUhXqfnJXQDLQj wgTwU4gMLc7S4r5XxEOp2Ul+RmsfYwvP/7keieWTtbD4jlWTIZzOuHuJ2tre+O8zlIaR1 cxJ2KvfksvBolH6Aln/MP61Hs0QiQPmtP3gNdabqqn8LK4YJP2OG7fiCC3pcSVJa/0eFy ff2RKvKekOURCU1jWpon+YB0460nEovK79t0omC50miVCPtux/SR2Ik9JqEZMLYdvHKYo KmYIGyclILJrH6Oo6mTfwJO9Mx39gIs243VSHKYlIw3BD5H4gfeOaxoENEjiaQZzJSA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796452398; 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=jDZWTi7oDy3VDvOJ6qaXVKT28rs96uiiFql2F3IicU8=; b=zTzyHqb8HQ8JNQgK3oZjsBc414/RInjFpNHC7imuz2CoV8AZ6WhKjEUMIyLICfnqQuN7 iNiBqEqHCTIFwSRc5F+qFxN8cnbWe/lyESeY3r3i3Gs47Q1NM3fKm/iosGi0s+2znetky 2U9AcF8caUsoZU6PFOsAXaIc9zPrOUb1vr8lXUdF5Obsw8WANMJU+ST8PgNBooT4uHCsa WQ2zTiJlFAlh9OK3PWKHyJ5/bbPBWiI0OEgbET31ynNURP4/IIIm+HOXgroEph+W71tE5 FK9rA1SlAL9VqKIhxcgOALC3wNf268eEo3Kqeioc4OR/5GEA1C4qiet8qPPgqx0d8Ng== 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=gv2DMIEC; arc=none smtp.remote-ip=74.125.82.180 Received: from mail-dy1-f180.google.com (mail-dy1-f180.google.com [74.125.82.180]) (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 1CCE960A261E for ; Sat, 5 Dec 2026 06:33:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1CCE960A261E 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=gv2DMIEC Received: by mail-dy1-f180.google.com with SMTP id 5a478bee46e88-387486ad5abso2648437eec.0 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=1796452397; x=1797057197; 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=jDZWTi7oDy3VDvOJ6qaXVKT28rs96uiiFql2F3IicU8=; b=gv2DMIECEdOfuc+3TRGyZPDe/I3vJVdydAKFAR9sXHJ0bsUplA/9yPgNVXEgyBXAm5 odWdgrjX/l+kI5VMp/AWFyWyUYlzvwBqAsUlNz3dUQ6vgxpDT8NbkkooxJ6vCy+eg53S rg6OKVQMKlrMNca3q9FBUS4c3gGqoYzzTi/zQ3tMWIjVAzjPO+7gZwcm2WnlIeVf1W7M hVub5fvKcg7xvZDPHYN67NW1G7WeApDHZJl5Nk2YEmEEeEIwfCZKBlqFU8rcg03SmEkm xL6QIpR5eBCx5tVSGriCV9kCAL6C8uQua/63/fgI5z6HVZXKdWGv/wviiIA8FIBooubN 3lZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796452397; x=1797057197; 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=jDZWTi7oDy3VDvOJ6qaXVKT28rs96uiiFql2F3IicU8=; b=DfqXt3j6UC7mbAcMuqRMNso78083kT/VPSIh6+HPwQkHXXqCrdIcbwZPSh/bek6ktX +20P7UOzyFKtEwnQsyO6Mrkw1EszwcPbybuKYtj0dqc64K7z8CncWtlBg3DQN9wJRtIB XK22k1zRTc7WypKpSO+q/P7BWzEjnuSbsBNfeqVsFqJqW0wwC/b35WeWREaL1dH174jk ZfmDh/zCZWNffIFBXcSOLI6k4AE0mqdRzkE1OsR2uShsQkVilO76mxUbqnZ+zQpArTJp N6UzwUAdqyOnKoNP41Y6i2D7bTQHdKpaz74uWA2BEyAAVl8zXd/xJ7XaykL+CZt+GVMC zhWg== X-Forwarded-Encrypted: i=1; AL+hErHaFsakoG5qebFxnEFyXvqZJ6yLfr0d3zpEV1/iGCOSvrNHO6uxuaHmN4P3cfFhq1wuJsAbEY54rh+hgMM=@vger.kernel.org X-Gm-Message-State: AB4q+uFxZYsoUIHl+nnPsH8acU7V2P8d1IcBm/BG63r9siiHBVWU30bx s9WLcRHQVpr6LBXcc0UKgl93BAplnTQ2LF6vZaE/JkCzYwTBRidjTZMk X-Gm-Gg: AZFdTZcEEdPtRgp8xDRjA9Dsfzk30jydoqUIrIRlEOUkLUQkb9YULz4J3wPxoBAk6v4 LV2C5RmP9be8rdRo6RabIpqUN/bJdf1FRj5zxXZQ0Lg7eVkxgB5nnGZc2ovTdc0dDoXbH4yoiqJ qIzna2MQzo5qeckejY7YgPSh/Am1Fx5J0b4YDdQ/n01Yz3PiSLxwVQXqumKoMYV6c1f/0j430Fi vLNTi5SK5eKUM20hg8ATpcMoRVtzdwE0L/ewSKyIW3fRPyTkvLnTrLwWacxoi8FeYE2o2r8KWoR VIIyFMARApXotrwKnFyr5vUdSqeB/0f0rh4GD/SKu+UyelqFmhtxGg/S1rnF0xMp2WrngFyaMhe aJ4FNIVA+de7EVd6BcICXoN+lh2jRsodc4WZ9Mw0ZI9wcdkFHTW1AHZoqDDITHNyE7koF7ywR1S GZDRy5WZCy+dGPZalsIOB3LGghhymFDvrp/DvgFB73IGQOf021C80fNnRCA1ITEyuOVOeqHuPSO LrwFzg+909X2S5r6e3McrxkTJgWx1YjHmNqAbhvVlijbDvD/Di5VqFNFkxef1B8zVepNUcI8h/c mXWkOi11WtEB+RgIm+B1FgfIj1/7GwQC3gc5nGjECnPA1fiEl1NZcOhroqfRFbd9m9ogOFc5YeU TpA/9HeLtsePq0A== X-Received: by 2002:a05:7300:ce03:b0:386:9ba8:2864 with SMTP id 5a478bee46e88-38751e57decmr3898714eec.0.1796452397072; Fri, 04 Dec 2026 22:33:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 22:33:16 -0800 (PST) From: Praneeth Balasubramanian To: Russell King , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Praneeth Balasubramanian , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/9] scsi: arm: Fix eh_abort race against the interrupt handler Date: Fri, 4 Dec 2026 22:32:25 -0800 Message-Id: <20261205063229.2518424-6-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-kernel@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 fas216_eh_abort() calls fas216_find_command() with no lock held and interrupts enabled. fas216_find_command() checks whether the command is disconnectable and clears info->SCpnt in separate steps. If the device interrupt fires in between, fas216_reselected_intr() restores the disconnectable command and puts the bus into PHASE_MSGIN. The abort then stores NULL into info->SCpnt while the target is reconnected. The next target-driven interrupt ends in fas216_done() with no current command, which panics the kernel. fas216_intr() itself takes no lock. These boards are single processor, so taking host_lock with irqs disabled serializes the abort against the interrupt handler. This matches what the bus and host reset handlers already do. Hold host_lock with irqs disabled around the fas216_find_command() call. It only removes commands from the driver queues, clears a bit and prints, so it is safe to call in atomic context. Update the stale comment about io_request_lock and disabled irqs as well. 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; arm rpc_defconfig, GCC 8.5), clang 23 unless noted. checkpatch.pl is clean. Not runtime-tested, and there is no reproducer. I do not have this hardware. These boards are uniprocessor ARM (RiscPC). Compile-tested with rpc_defconfig and the Acorn SCSI drivers as modules, using the kernel.org GCC 8.5 cross compiler (the platform needs GCC older than 9.1). drivers/scsi/arm/fas216.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index d0752c0bf425..7626f5102bf4 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c @@ -2422,11 +2422,14 @@ static enum res_find fas216_find_command(FAS216_Info *info, * * Abort this command. * Returns: FAILED if unable to abort - * Notes: io_request_lock is taken, and irqs are disabled + * Notes: the host lock is taken with irqs disabled while looking + * for the command */ int fas216_eh_abort(struct scsi_cmnd *SCpnt) { FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; + unsigned long flags; + enum res_find res; int result = FAILED; fas216_checkmagic(info); @@ -2438,7 +2441,11 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt) print_debug_list(); fas216_dumpstate(info); - switch (fas216_find_command(info, SCpnt)) { + spin_lock_irqsave(&info->host_lock, flags); + res = fas216_find_command(info, SCpnt); + spin_unlock_irqrestore(&info->host_lock, flags); + + switch (res) { /* * We found the command, and cleared it out. Either * the command is still known to be executing on the -- 2.25.1