From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.179 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796452398; b=Sux9/6uTlZXurHeiYgkCV0NsFQ0ZFHES8LzAvRkpzTcm//1fJTpzMjgK15efVrwRRZjq +DkLVJXagyeQF0JLW962kkrvLg8RMEY0AqsrWlyfYgztGM/umRKY9/6/cmUaHR8p0WQtr sKl5CDfFO0p5UeDCuWZQGLfCtkDD8yeWkWiNUgC5f4FZXLUnob0piJQ2VE6taNRbtL25J Lfyb/TljXZwoocMLm6IYodADDTCu163eISNOaT8PMwiuAHhAt4+IlHLMY1DctJpooQI2G JyMxj+bgCxSzmeAQb3cQ6Op93iHBW3OdPTMkHwPDGOIoj+CoKo6NmskRh2gFfEGzH+Q== 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=uzlaJOgTqj9a50iKvnsAC/Nv1grPIGV3Pv6BfVfVLn5XziqyoEnDjg7POWCXZgX6Ekpx E2m3QpGUtbqQyf153l/u3UXzPhqMgYYy/b+HXT79zW9Pzqzmc88JXDmDn7VdNr4mwhJsn l4Cq5FZ4xAJ/Fjj5wyfeP0qqbft59suLbg7d1DgeR/vkT7mxW571ITha8zj2SCGmUEC4o Kx2soDTEbK7vyQl2KBODR2FsXQrUmXidfgLYNRx+NwQFxnjAdzp9PKo3Opw75MQPo7ZtM 0JueTfAXdanpS3sYzoKzfyikvh2Lc6b9nl2pydQU1p42QoTCm9eOG4HYjeEXgTF60BQ== 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.179 Received: from mail-dy1-f179.google.com (mail-dy1-f179.google.com [74.125.82.179]) (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 0487760A2618 for ; Sat, 5 Dec 2026 06:33:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0487760A2618 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-f179.google.com with SMTP id 5a478bee46e88-387486ad5abso2648435eec.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=RbGKodqc3QWxvfaaIsCXE4LYUZ+ai5S2aM46Z8UsXX7xtQUzJzHFZAq/1zDBU7phxP i55dxhL2I8/Mtc7/X562tCLcbeysimkhrCoUYxQeyEtN/vB3BQPCQDVYFJu/nK5yYZu3 tRD4O+Y03H4bKZDQyi1/+DI8HeS1/3vASZBrI+N2P+Ov3ilV0S8hPVkyuUMQV08tR9vN 473GxeklD61LPxtVq2uzyhD81YHPpbiVNzbW8n0R2J+EvADw3dXWf2TwIMj5BicjXqOB 4nJWJYgNqX+lfDwDVLbD59TIMZxZnPwxbBOQP0ukL21qpILunKjhkCwN/4ZRWBxNxWW4 Ij5Q== X-Forwarded-Encrypted: i=1; AL+hErHPnk1OtrUmdzuUpyKxqM2OMPqrlR9z/5bA2dMh/Us7dQwsnf4+ykFYy6Lg+rLMo94bWIt3BXM=@vger.kernel.org X-Gm-Message-State: AB4q+uFHGxko7LWUlwBolX72spU8Wt3tEdQbqr/fVQoYAAJ0iX7JHLMc mZ1LQCjLRSTDaaq57ML3AF/J4DrKaI/fOyDKMV3TLY2dKk/XT3xeLcYb X-Gm-Gg: AZFdTZciSdeoS8C+gjiizrItTI77jagnoKGemzKVIHcA72PpEKfoitBVYbSqXZAVYN6 6Ad5oCSBU/Imc8shuud9lxYuPbKmRLRG7sOt7S6rwllGRBwdhhpqwtS0bRMeQ/kLa7uP659/c3x xDC9IEeX0AYKZCKEwehdgouFZ49PNU+Otoza6u2i7h8OBPyGStq8N+xykiQFmRCw81Ia9OlgJqt CuL+oourFv0BF5Pi8BlolELMpUS5hGXmex0e3nrRQYAdwds14p3eInyodfDktuCY1Kz+fanU5VO x/D5r63CrT0HQlimp3qFG8BVmgXh0/qMSXLVQkdJTa1goH9AhCQBHkauz/i/I/jPnAyggsbuXKW c5Z1WjWY3OrzmZmCNZLRV/azlWGxCdXHXlYDqOEG6KOoGtzMR0H6V/d6cdmVKamKPaIDmkaF0M0 071LzLnceKH3VDNe3qXfV1mtL9DgmosK+pZ7pGxoW6lUH34I7nkqeEIarByXvjT1CJXtFWMqj82 ybidnoaCOl6dMFNpVnyhn3iu/Na7rGtkFt+y11NWKrjw2Dsz2DJQq89daorX9vv1ocUwzKFFjrY 2hRlhjMQSZyOJLjB1IfSwS4cLOWo06ImwBY0xYZfFvz2xSX9suFgEFtutqu+R0czcrOPUG4OUW8 TpGYSv/ZPdI+bBA== 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: 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 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