From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Dan Carpenter <dan.carpenter@linaro.org>,
Damien Le Moal <dlemoal@kernel.org>,
Niklas Cassel <cassel@kernel.org>
Subject: [PATCH 6.1 02/69] ata: libata-scsi: Fix ata_scsi_dev_rescan() error path
Date: Mon, 15 Apr 2024 16:20:33 +0200 [thread overview]
Message-ID: <20240415141946.242468089@linuxfoundation.org> (raw)
In-Reply-To: <20240415141946.165870434@linuxfoundation.org>
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <dlemoal@kernel.org>
commit 79336504781e7fee5ddaf046dcc186c8dfdf60b1 upstream.
Commit 0c76106cb975 ("scsi: sd: Fix TCG OPAL unlock on system resume")
incorrectly handles failures of scsi_resume_device() in
ata_scsi_dev_rescan(), leading to a double call to
spin_unlock_irqrestore() to unlock a device port. Fix this by redefining
the goto labels used in case of errors and only unlock the port
scsi_scan_mutex when scsi_resume_device() fails.
Bug found with the Smatch static checker warning:
drivers/ata/libata-scsi.c:4774 ata_scsi_dev_rescan()
error: double unlocked 'ap->lock' (orig line 4757)
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes: 0c76106cb975 ("scsi: sd: Fix TCG OPAL unlock on system resume")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/ata/libata-scsi.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4667,7 +4667,7 @@ void ata_scsi_dev_rescan(struct work_str
* bail out.
*/
if (ap->pflags & ATA_PFLAG_SUSPENDED)
- goto unlock;
+ goto unlock_ap;
if (!sdev)
continue;
@@ -4680,7 +4680,7 @@ void ata_scsi_dev_rescan(struct work_str
if (do_resume) {
ret = scsi_resume_device(sdev);
if (ret == -EWOULDBLOCK)
- goto unlock;
+ goto unlock_scan;
dev->flags &= ~ATA_DFLAG_RESUMING;
}
ret = scsi_rescan_device(sdev);
@@ -4688,12 +4688,13 @@ void ata_scsi_dev_rescan(struct work_str
spin_lock_irqsave(ap->lock, flags);
if (ret)
- goto unlock;
+ goto unlock_ap;
}
}
-unlock:
+unlock_ap:
spin_unlock_irqrestore(ap->lock, flags);
+unlock_scan:
mutex_unlock(&ap->scsi_scan_mutex);
/* Reschedule with a delay if scsi_rescan_device() returned an error */
next prev parent reply other threads:[~2024-04-15 14:38 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 14:20 [PATCH 6.1 00/69] 6.1.87-rc1 review Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 01/69] smb3: fix Open files on server counter going negative Greg Kroah-Hartman
2024-04-15 14:20 ` Greg Kroah-Hartman [this message]
2024-04-15 14:20 ` [PATCH 6.1 03/69] batman-adv: Avoid infinite loop trying to resize local TT Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 04/69] ring-buffer: Only update pages_touched when a new page is touched Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 05/69] Bluetooth: Fix memory leak in hci_req_sync_complete() Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 06/69] drm/amd/pm: fixes a random hang in S4 for SMU v13.0.4/11 Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 07/69] PM: s2idle: Make sure CPUs will wakeup directly on resume Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 08/69] media: cec: core: remove length check of Timer Status Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 09/69] arm64: dts: imx8-ss-conn: fix usdhc wrong lpcg clock order Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 10/69] Revert "drm/qxl: simplify qxl_fence_wait" Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 11/69] nouveau: fix function cast warning Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 12/69] scsi: hisi_sas: Modify the deadline for ata_wait_after_reset() Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 13/69] scsi: qla2xxx: Fix off by one in qla_edif_app_getstats() Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 14/69] net: openvswitch: fix unwanted error log on timeout policy probing Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 15/69] u64_stats: fix u64_stats_init() for lockdep when used repeatedly in one file Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 16/69] xsk: validate user input for XDP_{UMEM|COMPLETION}_FILL_RING Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 17/69] geneve: fix header validation in geneve[6]_xmit_skb Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 18/69] bnxt_en: Reset PTP tx_avail after possible firmware reset Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 19/69] net: ks8851: Inline ks8851_rx_skb() Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 20/69] net: ks8851: Handle softirqs at the end of IRQ thread to fix hang Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 21/69] af_unix: Clear stale u->oob_skb Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 22/69] octeontx2-af: Fix NIX SQ mode and BP config Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 23/69] ipv6: fib: hide unused pn variable Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 24/69] ipv4/route: avoid unused-but-set-variable warning Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 25/69] ipv6: fix race condition between ipv6_get_ifaddr and ipv6_del_addr Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 26/69] Bluetooth: SCO: Fix not validating setsockopt user input Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 27/69] Bluetooth: L2CAP: " Greg Kroah-Hartman
2024-04-15 14:20 ` [PATCH 6.1 28/69] netfilter: complete validation of " Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 29/69] net/mlx5: Properly link new fs rules into the tree Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 30/69] net/mlx5e: Fix mlx5e_priv_init() cleanup flow Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 31/69] net/mlx5e: HTB, Fix inconsistencies with QoS SQs number Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 32/69] net: sparx5: fix wrong config being used when reconfiguring PCS Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 33/69] net: dsa: mt7530: trap link-local frames regardless of ST Port State Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 34/69] af_unix: Do not use atomic ops for unix_sk(sk)->inflight Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 35/69] af_unix: Fix garbage collector racing against connect() Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 36/69] net: ena: Fix potential sign extension issue Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 37/69] net: ena: Wrong missing IO completions check order Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 38/69] net: ena: Fix incorrect descriptor free behavior Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 39/69] tracing: hide unused ftrace_event_id_fops Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 40/69] iommu/vt-d: Allocate local memory for page request queue Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 41/69] btrfs: qgroup: correctly model root qgroup rsv in convert Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 42/69] btrfs: record delayed inode root in transaction Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 43/69] btrfs: qgroup: convert PREALLOC to PERTRANS after record_root_in_trans Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 44/69] io_uring/net: restore msg_control on sendzc retry Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 45/69] kprobes: Fix possible use-after-free issue on kprobe registration Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 46/69] drm/i915/vrr: Disable VRR when using bigjoiner Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 47/69] drm/amdkfd: Reset GPU on queue preemption failure Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 48/69] drm/ast: Fix soft lockup Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 49/69] drm/client: Fully protect modes[] with dev->mode_config.mutex Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 50/69] vhost: Add smp_rmb() in vhost_vq_avail_empty() Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 51/69] vhost: Add smp_rmb() in vhost_enable_notify() Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 52/69] perf/x86: Fix out of range data Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 53/69] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 54/69] selftests: timers: Fix abs() warning in posix_timers test Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 55/69] x86/apic: Force native_apic_mem_read() to use the MOV instruction Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 56/69] irqflags: Explicitly ignore lockdep_hrtimer_exit() argument Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 57/69] x86/bugs: Fix return type of spectre_bhi_state() Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 58/69] x86/bugs: Fix BHI documentation Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 59/69] x86/bugs: Cache the value of MSR_IA32_ARCH_CAPABILITIES Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 60/69] x86/bugs: Rename various ia32_cap variables to x86_arch_cap_msr Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 61/69] x86/bugs: Fix BHI handling of RRSBA Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 62/69] x86/bugs: Clarify that syscall hardening isnt a BHI mitigation Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 63/69] x86/bugs: Remove CONFIG_BHI_MITIGATION_AUTO and spectre_bhi=auto Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 64/69] x86/bugs: Replace CONFIG_SPECTRE_BHI_{ON,OFF} with CONFIG_MITIGATION_SPECTRE_BHI Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 65/69] drm/i915/cdclk: Fix CDCLK programming order when pipes are active Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 66/69] drm/i915: Disable port sync when bigjoiner is used Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 67/69] drm/amdgpu: Reset dGPU if suspend got aborted Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 68/69] drm/amdgpu: always force full reset for SOC21 Greg Kroah-Hartman
2024-04-15 14:21 ` [PATCH 6.1 69/69] drm/amd/display: fix disable otg wa logic in DCN316 Greg Kroah-Hartman
2024-04-15 17:36 ` [PATCH 6.1 00/69] 6.1.87-rc1 review Florian Fainelli
2024-04-15 19:47 ` Pavel Machek
2024-04-15 23:53 ` Kelsey Steele
2024-04-16 0:17 ` Mark Brown
2024-04-16 6:34 ` Ron Economos
2024-04-16 11:55 ` Yann Sionneau
2024-04-16 12:03 ` Jon Hunter
2024-04-16 14:22 ` Pascal Ernster
2024-04-16 20:18 ` Mateusz Jończyk
2024-04-17 7:43 ` Naresh Kamboju
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240415141946.242468089@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=cassel@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=dlemoal@kernel.org \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox