From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796452398; b=hGSZLMHAZCxrmO+S8dskbfkvqjBDDHjX55qny9U4CHjwsdD4ZNbYFx+2R7u4l6f7ig4s db58HaILO1XJEZvGHEMm59VvYh0mbWaBeFM+u/Q5nWLxhy+DrpjK7DVgQFgt8fpxG98Qz RCc+9rdzAcNnADFJbPiAuuw/4D22bLnq5Vhl7q9lBEVz3gyGRqFWNWRScCBQbOWtEgyff 9o8SyJ66lQQvkKIiM0Ndpm+iqmn5lxxbKFXEd570+V+VgMIE/IMQ41jS6+id6sAwv1hKp hsBCFH1mVXXAsu3sKaMRCiEJS3jP3CTgaedIJ9908mntP7uDRt67aVzH0xthKQwa+yQ== 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=rMNlfUcgtFfYg1dPLH32Rmilrv1npGUL7oWvVgJ/ln08supCJ9YMtX86byofiPwL8x92 pOKWfGebyB0ejArO9dZtpFdybvmuEkGVjtjZvAIR6OKFkaUDRCpe2GV3YhwKNX0ykaxSv v8dCswO2emG+cp0ni2m4RgmaA1oEzWXNEtyHSMMv8ftNyhGtUnuws032JvyQyqtfaCrQz IyGgHSFZ4de61BJ+Gn3DIkEWkO64Y5g+bZK+Ry8ToABwq3HuOqsUWQdr2MYIBdBsVIU8Y UGdnrozPlLE7btDl3I8nEsrXGSzAjb3P4fUKahPAUcY7qp8KrEdT0Z1X+kMne5YD/Ig== 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.172 Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172]) (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 08E38606A339 for ; Sat, 5 Dec 2026 06:33:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 08E38606A339 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-f172.google.com with SMTP id 5a478bee46e88-38190551625so2012085eec.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=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=nclURWMP3xOcshlQj3iJpajqL3j0TgHt6PuhA9Qa+IBi/fCPdR8Nbg1DxhNZsucjfF 60wEwtEzKtDJ5KsRoJ0MP8lKNdD5A9p7O8PHlMNSK1V+gQzLvJg9oKjzpRTFkPFKJVAl qgyL70Qn/nF4rlCc6e6KJvLtscntCUAhlVEO6L8pBaG1z3uTueDWfsMV9F+lsfINObL6 lChdOK/BThY3K8eCSETH/j7u0fuo6eAmZ0hTu/6KeV4R9nFGdCBi1UewjByKxOGnl2JM eortuI/21sHBXtPf4YyEah4fZSBsZHY+zePNmRNQ5LgyYdCI9Hq0Q8YA/0jYk3sfL4ax 8s2Q== X-Forwarded-Encrypted: i=1; AL+hErECgGbQG4oLMTfhgclEEykzzG2QdcR8wArOI6JGxhWFcfMynY9o4d5kMaiaeG1iFWLLLqE4w2A6Ith4@vger.kernel.org X-Gm-Message-State: AB4q+uHG4BEagIlTdQ1btxwdgKq3FNM9TquGX7bHTaDZhUBwfWwwasdr Zw+DgMGxw1LaeS+aNbWWB9vWMMIsCAeTYbNiIaqTNBoLSpubJ9uYCFcs6oDf+be4 X-Gm-Gg: AZFdTZewTW+mYY5lEAIsU1ji8RT/hXO2c8yuv2Kn9OW6wjQcAnRt6nQ5C2bqolXLvui hrJR1fKu27F8dbDvb7KtdhRV+KzR6S6w6nsHRu7bAMy4RPwPF1eZLbca/nFeAwPamJJ9LtgAFeI Rt/8+oezzVG9GVv6ZFyAk9SCiMoE1/s478/R2nZJAwKjKQDGQpGlq2pPVwegVm7obioFJ7dN1Dd 2rR2QZS7BpZ5r3A46rqAp3I3+2zYMququ9X66u2ITmIMiBbU9aW8eEkxR/l/WYrgu9/ngrHcEya PNULs4epTuj1HHgAeMskF21dh1AZdvgd8tDco3Fel6JKpM9SQNzcout4EfK1Jm2iLuf5g5K0V7t wbf7nspppbg4pLZIqwYJ8FxZMObh2NlLWKIw4uQ0Hrh1pCBnD/Yljy6juyob6M0W1BJcsxkW08V P7jG+Y2+mg2RP9kpo1y1CuAep4Z5fFU76DknHf3C+7GezYeDUNTZCC2Bb5ur8+vp2vccy4JH9iU Uxe+cLQ+5kzZOrFB45bEG8zqe2XmPewGiuV57n8fWnFl0nlJmHNZi3kSTNKfikbKDzMz0k0VMhM J1knkOIjdlKsyosWid5uayQh/GItM9bykLhHgEl4vynbccNfEzit0XyHM+4UJa/B/Ez4b738xww 4XYTepVeon3gOJA== 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-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 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