From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796453448; b=KXUSFvAoe6UZkEWJAo4sEG2446mjFRwlwPNLlhC7cxtxAzQZL1mvVUe3/sOaNAnzoRI9 +Q/y/yqEqsOsr559/Ha3vL4Aoj33j378bGH+yxtpo0O6+rxpI7mTvtZ9nGh3kVWDWLdep vbF4x5yW/EMkXc7r1PB+FI+aYdZUPzLrMZ4RCYwp1+pKxqlF2xwrznCR1t4GP0A6X6Iuy aLbwyv/hgok4Eea/7/+jhv22GAM7/NMSZ2HN9XFXmh2gGnHPpvhpcB3iprV4xzA8hWvBm AKtNX2rFY8JE9q9od8FFonZl0O3Dy6deQdUVBiSMjJpHfaAPJxX5iES5G8+MAEvt2zA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796453448; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=TZjPxQ54TSfeEr0OYLSMCrPMG5KFL8MY5leKa/L8vzo=; b=zcqPin3MQn906KcXCfDyeBczFnTIkXfEda+gwlXtKvMhSw3HhmiyFDQdCJ6QiFC3IK8x xbtuSU76QUVXMlTLcZX1/zwu9LKXDPXe+tim8GNN1aVhheI01yuuJlHPe3SF+ufI5jpM4 fUdQp9KdkUPnkhv6eDclMkUNAIJriXC3R6fcNKiEQCM0b0vVTbjWtsbXmFltfyFNWT03e mq1qnt6IebBxAyIYoy6qkpqYSmT2uR4jO9Nfji9M0O6LryXEVWfY/13Y6uw2DC+qpi11k Z4tWWRIMHQIiKx7KqytkCR8ufby7N8K/00LO9Rh3QPzo9olReKbvnR/qCd9yWzHyXmA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=McrWVrxP; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56678606A322 for ; Sat, 5 Dec 2026 06:50:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=McrWVrxP Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CAD31F0092B; Sat, 5 Dec 2026 06:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796453448; bh=TZjPxQ54TSfeEr0OYLSMCrPMG5KFL8MY5leKa/L8vzo=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=McrWVrxPgSlphyOGyT8Rj19KDPDp2nf5nv3MQbrMMfzI0xyFDQENPRbAnGYSr4J5l Dc/4W+2XsH28wEsLn0Zb85ub8/cpFRGEiYZ16ghivAZ+nJNWaRtBEcGdWmQ2kN/goV 5h4WuQMpSin1MtgjyZpnxZIrWjsRZgSbF5hKai1beaXZupuXbdV3q4x/my/iJMq5hM 6SUASAGU3PxZJ51j1cEBRCGyG8gMDlkhkb28iqxRuj++5V62HpPE0YGT95RQghF4u6 dXabsACmyiNG9aS19ZvkCmT7VfZgi+DisaKyKb06pmoKqKVa724Bd6uDh9hwrNHyyy GbiJf/1fptBxw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 5/9] scsi: arm: Fix eh_abort race against the interrupt handler Reply-To: sashiko-reviews@lists.linux.dev To: "Praneeth Balasubramanian" Cc: linux-scsi@vger.kernel.org In-Reply-To: <20261205063229.2518424-6-praneethb2002@gmail.com> References: <20261205063229.2518424-1-praneethb2002@gmail.com> <20261205063229.2518424-6-praneethb2002@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 06:50:47 +0000 X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] scsi: arm: fas216_eh_abort() still races with fas216_intr() on PREEMPT_RT - [Low] scsi: arm: commit message and comment misidentify host_lock usage - [Low] scsi: arm: Fixes tag cites 1da177e4c3f4 instead of 8fa728a26886 -- commit 1d23771aaa676d4441b57629afe17d79f3ca6e95 Author: Praneeth Balasubramanian > scsi: arm: Fix eh_abort race against the interrupt handler > > 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 [Severity: Low] Should the Fixes tag reference 8fa728a26886 ("[SCSI] allow sleeping in ->eh_abort_handler()") instead of 1da177e4c3f4 ("Linux-2.6.12-rc2")? In 1da177e4c3f4 ("Linux-2.6.12-rc2"), drivers/scsi/scsi_error.c still held host->host_lock with interrupts disabled around eh_abort_handler(). Commit 8fa728a26886 ("[SCSI] allow sleeping in ->eh_abort_handler()") removed that locking without updating fas216_eh_abort(). > diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c > index d0752c0bf4254..7626f5102bf45 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_I= nfo *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 > */ [Severity: Low] Could this comment name info->host_lock explicitly? This driver uses both info->host_lock and info->host->host_lock, so "the host lock" is ambiguous. The commit message also says this matches the bus and host reset handlers, but fas216_eh_host_reset() acquires info->host->host_lock; it is fas216_eh_device_reset() and fas216_eh_bus_reset() that take info->host_lock. In addition, while fas216_intr() itself takes no lock, its callees fas216_disconnect_intr() and fas216_done() acquire info->host_lock around fas216_kick(). [ ... ] > @@ -2438,7 +2441,11 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt) > print_debug_list(); > fas216_dumpstate(info); > =20 > - switch (fas216_find_command(info, SCpnt)) { > + spin_lock_irqsave(&info->host_lock, flags); > + res =3D fas216_find_command(info, SCpnt); > + spin_unlock_irqrestore(&info->host_lock, flags); [Severity: Medium] Does spin_lock_irqsave(&info->host_lock, flags) still race with fas216_intr() under CONFIG_PREEMPT_RT? ARM selects ARCH_SUPPORTS_RT, so CONFIG_PREEMPT_RT can be enabled with CONFIG_ARCH_RPC. Because info->host_lock is a spinlock_t, spin_lock_irqsave() leaves interrupts and preemption enabled on PREEMPT_RT. The IRQ-driven front-ends register handlers without IRQF_NO_THREAD, so they run in SCHED_FIFO forced-threaded IRQ threads that skip local_irq_disable() on PREEMPT_RT and can preempt fas216_eh_abort(): fas216_eh_abort() spin_lock_irqsave(&info->host_lock, flags) fas216_find_command() info->scsi.disconnectable =3D 0 fas216_intr() fas216_reselected_intr() info->scsi.phase =3D PHASE_MSGIN info->SCpnt =3D NULL <-- clears reconnected command fas216_intr() ... -> fas216_done() <-- panic: null command In the polled arxescsi path, fas216_noqueue_command_lck() also invokes fas216_intr() under info->host->host_lock instead of info->host_lock, which provides no mutual exclusion against fas216_eh_abort() on PREEMPT_RT. Converting info->host_lock to raw_spinlock_t would break lock nesting with queue_remove_cmd()'s queue->queue_lock, so fixing this needs fas216_intr() serialized under info->host_lock while refactoring the inner info->host_lock acquisitions in fas216_disconnect_intr() and fas216_done(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205063229.2518= 424-1-praneethb2002@gmail.com?part=3D5