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=1796453225; b=FJcJZu/UmoOkYUKnaghqahhsxzFEX7z2kw6Rb5mXMfSbv/Al42vxa2s4qMsW/sTKT95P OkGnkPcYSnM7XbUvmbm5sDis3lJGgkmqNCtXjpWem1v83hwGsP74YG1lFTFLEMfxLO9De 3qi912l9apsGuqDvolCR5kW6SYP2AIjeveNo3h30pFOj8xELiGeSrXMsmE4ahPJ4LBQ6d fZfdh9PlHJoBgGxad+8L149xV4oGGQU0D/PXXuXnaub9L+Lr/hVLaWfE9LKhAATmGnM2z kjn9LQcDE0GDLa1Acd1kwomeVBRF7ftPm/v1qWlEnwC9w0NEGADz/aywwyRYtx05wOg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796453225; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ycvfVFGMtmKjavGv2KDXEzA1EAo56fVm3rsmNcLcp1I=; b=4PwQlttpu6lkPEFTzSFJ5kfYmNhwWSCuZAurMk7X0QgM0NCKtQb7Qr9sSenYwP575ZZO Eymhto4CPvoJ9crUA9moFDv1D/7IZw+CHpRibLP845Os7pRitg5VbOVraYQHyleq1gLw8 i04GS90/VazQzcnyIV9JoCmqmB1zu2uQPBgG/1qyHNkFjNb++WvjZYRCv+OeMBuZAJAnE ZTCrXGlfK2h8J9VISr4qqT8Pu9wNdcXmuM0W2fBbL3fLNIWXsHSRC57dfHEcyarfuYn7a f1gaje0vurTQAroFMtq9dUL2ccEi/47up1DlQ339OVN5NfTtoMgXXVcMhA7iTyV2nXA== 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=fE0QhpWH; 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 90E96606A322 for ; Sat, 5 Dec 2026 06:47:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fE0QhpWH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29D3A1F0092B; Sat, 5 Dec 2026 06:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796453225; bh=ycvfVFGMtmKjavGv2KDXEzA1EAo56fVm3rsmNcLcp1I=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=fE0QhpWHCjlYKYs+xFMHz+lB/R/GxOaMVoJ4C53N7z5WPcxRLNJxr5OY8BQenmuZa V1DEuzTAPLb2rhjn4excS+Zta3+lIcOU04gmBO0QsSPxjZNyqHXDTG7RHbiTswY6k/ A7xBwWXfaSpBA2LTKdDXkvHT5a8Pns3VYf4Rcs2/EfxnCqpSB0T9F3RQnrCd4JO2Q0 jbZenWxMcesANRd6zD3STRWV2JlkUOjBZ9mTGLHVgh21UMWWbWnoDxIttxf8Odos1G k4LHVMliNLo7sM3slIT9eJMIwTnYpZHSy2Pa9mZTtzpZw7K5VRpivg7wZl47U027HP 5B0MVoWSbDR5Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 6/9] scsi: csiostor: hold hw lock when issuing port stats mailbox command Reply-To: sashiko-reviews@lists.linux.dev To: "Praneeth Balasubramanian" Cc: linux-scsi@vger.kernel.org In-Reply-To: <20261205063229.2518424-7-praneethb2002@gmail.com> References: <20261205063229.2518424-1-praneethb2002@gmail.com> <20261205063229.2518424-7-praneethb2002@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 06:47:04 +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 2 potential issues to consider: - [High] scsi: csiostor: spin_lock_irq() held across mdelay() mailbox poll in sysfs - [Low] scsi: csiostor: commit message wrongly claims all other mailbox users lock -- commit 3e9312623f9e3af6f4f38c2c746ee8490b4ad18e Author: Praneeth Balasubramanian scsi: csiostor: hold hw lock when issuing port stats mailbox command This commit takes hw->lock with spin_lock_irq() around csio_mb_issue() in csio_get_phy_port_stats(). > csio_get_phy_port_stats() calls csio_mb_issue() without holding > hw->lock. The comment above csio_mb_issue() says that the caller should > hold the hw lock, and the other mailbox users in the driver do. [Severity: Low] Is the commit message accurate in saying that the other mailbox users in the driver hold hw->lock? Several reset and configuration paths explicitly drop hw->lock before issuing mailbox commands, such as csio_hw_initialize() -> csio_config_queues() and csio_hw_configure() -> csio_hw_flash_fw(). Since csio_device_reset() can run those paths while the fc_host sysfs attributes are exposed, holding hw->lock here does not close all concurrent mailbox races. [ ... ] > diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/c= sio_lnode.c > index 161973957976b..7fef0882862f6 100644 > --- a/drivers/scsi/csiostor/csio_lnode.c > +++ b/drivers/scsi/csiostor/csio_lnode.c > @@ -1408,11 +1408,14 @@ csio_get_phy_port_stats(struct csio_hw *hw, uint8= _t portid, > portparams.nstats =3D 4; > csio_fcoe_read_portparams_init_mb(hw, mbp, CSIO_MB_DEFAULT_TMO, > &portparams, NULL); > + spin_lock_irq(&hw->lock); > if (csio_mb_issue(hw, mbp)) { > csio_err(hw, "Issue of FCoE port params failed!\n"); > mempool_free(mbp, hw->mb_mempool); > + spin_unlock_irq(&hw->lock); > return -EINVAL; > } > + spin_unlock_irq(&hw->lock); > csio_mb_process_portparams_rsp(hw, mbp, &retval, > &portparams, port_stats); > } [Severity: High] Can holding hw->lock with interrupts disabled across csio_mb_issue() stall adapter I/O and trigger hardlockups? With cbfn NULL and CSIO_MB_DEFAULT_TMO (10 seconds), csio_mb_issue() unconditionally runs mdelay(5) before its first status read and polls up to 10 seconds. Across the three loop iterations, each sysfs read holds hw->lock with IRQs off for at least 15 ms, or 10 seconds on a timeout. hw->lock is taken by csio_queuecommand() on every SCSI submission and by csio_process_scsi_cmpl() in hardirq context. An unprivileged user reading the world-readable fc_host statistics attributes in a loop can starve storage I/O and interrupts across CPUs, and a timeout risks a hardlockup. Since csio_get_stats() runs in sleepable sysfs context, csio_get_phy_port_stats() could issue the mailbox command asynchronously with a callback completing mbp->cmplobj and wait outside hw->lock via wait_for_completion(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205063229.2518= 424-1-praneethb2002@gmail.com?part=3D6