All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.18 01/49] IB/rdmavt: add missing locks in rvt_ruc_loopback
@ 2022-06-01 13:51 Sasha Levin
  2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 02/49] PCI/ASPM: Make Intel DG2 L1 acceptable latency unlimited Sasha Levin
                   ` (47 more replies)
  0 siblings, 48 replies; 81+ messages in thread
From: Sasha Levin @ 2022-06-01 13:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Niels Dossche, Jason Gunthorpe, Sasha Levin, dennis.dalessandro,
	linux-rdma

From: Niels Dossche <dossche.niels@gmail.com>

[ Upstream commit 22cbc6c2681a0a4fe76150270426e763d52353a4 ]

The documentation of the function rvt_error_qp says both r_lock and
s_lock need to be held when calling that function.
It also asserts using lockdep that both of those locks are held.
rvt_error_qp is called form rvt_send_cq, which is called from
rvt_qp_complete_swqe, which is called from rvt_send_complete, which is
called from rvt_ruc_loopback in two places. Both of these places do not
hold r_lock. Fix this by acquiring a spin_lock of r_lock in both of
these places.
The r_lock acquiring cannot be added in rvt_qp_complete_swqe because
some of its other callers already have r_lock acquired.

Link: https://lore.kernel.org/r/20220228195144.71946-1-dossche.niels@gmail.com
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/sw/rdmavt/qp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 8ef112f883a7..3acab569fbb9 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -2775,7 +2775,7 @@ void rvt_qp_iter(struct rvt_dev_info *rdi,
 EXPORT_SYMBOL(rvt_qp_iter);
 
 /*
- * This should be called with s_lock held.
+ * This should be called with s_lock and r_lock held.
  */
 void rvt_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe,
 		       enum ib_wc_status status)
@@ -3134,7 +3134,9 @@ void rvt_ruc_loopback(struct rvt_qp *sqp)
 	rvp->n_loop_pkts++;
 flush_send:
 	sqp->s_rnr_retry = sqp->s_rnr_retry_cnt;
+	spin_lock(&sqp->r_lock);
 	rvt_send_complete(sqp, wqe, send_status);
+	spin_unlock(&sqp->r_lock);
 	if (local_ops) {
 		atomic_dec(&sqp->local_ops_pending);
 		local_ops = 0;
@@ -3188,7 +3190,9 @@ void rvt_ruc_loopback(struct rvt_qp *sqp)
 	spin_unlock_irqrestore(&qp->r_lock, flags);
 serr_no_r_lock:
 	spin_lock_irqsave(&sqp->s_lock, flags);
+	spin_lock(&sqp->r_lock);
 	rvt_send_complete(sqp, wqe, send_status);
+	spin_unlock(&sqp->r_lock);
 	if (sqp->ibqp.qp_type == IB_QPT_RC) {
 		int lastwqe;
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 81+ messages in thread

end of thread, other threads:[~2022-06-05 13:40 UTC | newest]

Thread overview: 81+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 13:51 [PATCH AUTOSEL 5.18 01/49] IB/rdmavt: add missing locks in rvt_ruc_loopback Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 02/49] PCI/ASPM: Make Intel DG2 L1 acceptable latency unlimited Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 03/49] ARM: dts: ox820: align interrupt controller node name with dtschema Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 04/49] ARM: dts: socfpga: " Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 05/49] ARM: dts: s5pv210: align DMA channels " Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 06/49] ASoC: amd: Add driver data to acp6x machine driver Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 07/49] arm64: dts: qcom: msm8994: Fix the cont_splash_mem address Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 08/49] arm64: dts: qcom: msm8994: Fix BLSP[12]_DMA channels count Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 09/49] PM / devfreq: rk3399_dmc: Disable edev on remove() Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 10/49] crypto: ccree - use fine grained DMA mapping dir Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 11/49] crypto: qat - fix off-by-one error in PFVF debug print Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 12/49] soc: ti: ti_sci_pm_domains: Check for null return of devm_kcalloc Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 13/49] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 14/49] arm64: dts: qcom: sdm845-xiaomi-beryllium: fix typo in panel's vddio-supply property Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 15/49] arm64: Expand ESR_ELx_WFx_ISS_TI to match its ARMv8.7 definition Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 15:26   ` Marc Zyngier
2022-06-01 15:26     ` Marc Zyngier
2022-06-05 13:38     ` Sasha Levin
2022-06-05 13:38       ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 16/49] ALSA: usb-audio: Add quirk bits for enabling/disabling generic implicit fb Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 17/49] ALSA: usb-audio: Move generic implicit fb quirk entries into quirks.c Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 18/49] ARM: OMAP1: clock: Fix UART rate reporting algorithm Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 19/49] selftests/resctrl: Change the default limited time to 120 seconds Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 20/49] powerpc/fadump: Fix fadump to work with a different endian capture kernel Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 21/49] fat: add ratelimit to fat*_ent_bread() Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 22/49] pinctrl: renesas: rzn1: Fix possible null-ptr-deref in sh_pfc_map_resources() Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 23/49] ARM: versatile: Add missing of_node_put in dcscb_init Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 24/49] ARM: dts: exynos: add atmel,24c128 fallback to Samsung EEPROM Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 25/49] arm64: dts: qcom: sc7280-idp: Configure CTS pin to bias-bus-hold for bluetooth Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 26/49] arm64: dts: qcom: sc7280-qcard: " Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 27/49] ARM: hisi: Add missing of_node_put after of_find_compatible_node Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 28/49] cpufreq: Avoid unnecessary frequency updates due to mismatch Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 29/49] PCI: microchip: Add missing chained_irq_enter()/exit() calls Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 30/49] powerpc/rtas: Keep MSR[RI] set when calling RTAS Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 31/49] PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store() Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 32/49] PCI: cadence: Clear FLR in device capabilities register Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 33/49] KVM: PPC: Book3S HV Nested: L2 LPCR should inherit L1 LPES setting Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 34/49] alpha: fix alloc_zeroed_user_highpage_movable() Sasha Levin
2022-06-01 13:51 ` [PATCH AUTOSEL 5.18 35/49] KVM: arm64: vgic: Do not ignore vgic_its_restore_cte failures Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 13:51   ` Sasha Levin
2022-06-01 16:45   ` Marc Zyngier
2022-06-01 16:45     ` Marc Zyngier
2022-06-01 16:45     ` Marc Zyngier
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 36/49] cifs: fix signed integer overflow when fl_end is OFFSET_MAX Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 37/49] tracing: incorrect isolate_mote_t cast in mm_vmscan_lru_isolate Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 38/49] cifs: return ENOENT for DFS lookup_cache_entry() Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 39/49] powerpc/powernv/vas: Assign real address to rx_fifo in vas_rx_win_attr Sasha Levin
2022-06-01 13:52   ` Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 40/49] powerpc/xics: fix refcount leak in icp_opal_init() Sasha Levin
2022-06-01 13:52   ` Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 41/49] powerpc/powernv: fix missing of_node_put in uv_init() Sasha Levin
2022-06-01 13:52   ` Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 42/49] macintosh/via-pmu: Fix build failure when CONFIG_INPUT is disabled Sasha Levin
2022-06-01 13:52   ` Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 43/49] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart Sasha Levin
2022-06-01 13:52   ` Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 44/49] fanotify: fix incorrect fmode_t casts Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 45/49] smb3: check for null tcon Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 46/49] RDMA/hfi1: Prevent panic when SDMA is disabled Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 47/49] cifs: do not use tcpStatus after negotiate completes Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 48/49] Input: gpio-keys - cancel delayed work only in case of GPIO Sasha Levin
2022-06-01 13:52 ` [PATCH AUTOSEL 5.18 49/49] drm: fix EDID struct for old ARM OABI format Sasha Levin
2022-06-01 13:52   ` Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.