From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Meir Elisha <meir.elisha@volumez.com>,
Sagi Grimberg <sagi@grimberg.me>, Keith Busch <kbusch@kernel.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1 041/109] nvmet-tcp: Fix a possible sporadic response drops in weakly ordered arch
Date: Mon, 10 Mar 2025 18:06:25 +0100 [thread overview]
Message-ID: <20250310170429.192614390@linuxfoundation.org> (raw)
In-Reply-To: <20250310170427.529761261@linuxfoundation.org>
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Meir Elisha <meir.elisha@volumez.com>
[ Upstream commit a16f88964c647103dad7743a484b216d488a6352 ]
The order in which queue->cmd and rcv_state are updated is crucial.
If these assignments are reordered by the compiler, the worker might not
get queued in nvmet_tcp_queue_response(), hanging the IO. to enforce the
the correct reordering, set rcv_state using smp_store_release().
Fixes: bdaf13279192 ("nvmet-tcp: fix a segmentation fault during io parsing error")
Signed-off-by: Meir Elisha <meir.elisha@volumez.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/tcp.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 81574500a57c7..125e22bd34e2a 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -520,10 +520,16 @@ static void nvmet_tcp_queue_response(struct nvmet_req *req)
struct nvmet_tcp_cmd *cmd =
container_of(req, struct nvmet_tcp_cmd, req);
struct nvmet_tcp_queue *queue = cmd->queue;
+ enum nvmet_tcp_recv_state queue_state;
+ struct nvmet_tcp_cmd *queue_cmd;
struct nvme_sgl_desc *sgl;
u32 len;
- if (unlikely(cmd == queue->cmd)) {
+ /* Pairs with store_release in nvmet_prepare_receive_pdu() */
+ queue_state = smp_load_acquire(&queue->rcv_state);
+ queue_cmd = READ_ONCE(queue->cmd);
+
+ if (unlikely(cmd == queue_cmd)) {
sgl = &cmd->req.cmd->common.dptr.sgl;
len = le32_to_cpu(sgl->length);
@@ -532,7 +538,7 @@ static void nvmet_tcp_queue_response(struct nvmet_req *req)
* Avoid using helpers, this might happen before
* nvmet_req_init is completed.
*/
- if (queue->rcv_state == NVMET_TCP_RECV_PDU &&
+ if (queue_state == NVMET_TCP_RECV_PDU &&
len && len <= cmd->req.port->inline_data_size &&
nvme_is_write(cmd->req.cmd))
return;
@@ -784,8 +790,9 @@ static void nvmet_prepare_receive_pdu(struct nvmet_tcp_queue *queue)
{
queue->offset = 0;
queue->left = sizeof(struct nvme_tcp_hdr);
- queue->cmd = NULL;
- queue->rcv_state = NVMET_TCP_RECV_PDU;
+ WRITE_ONCE(queue->cmd, NULL);
+ /* Ensure rcv_state is visible only after queue->cmd is set */
+ smp_store_release(&queue->rcv_state, NVMET_TCP_RECV_PDU);
}
static void nvmet_tcp_free_crypto(struct nvmet_tcp_queue *queue)
--
2.39.5
next prev parent reply other threads:[~2025-03-10 17:39 UTC|newest]
Thread overview: 120+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 17:05 [PATCH 6.1 000/109] 6.1.131-rc1 review Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 001/109] ibmvnic: Perform tx CSO during send scrq direct Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 002/109] ibmvnic: Inspect header requirements before using " Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 003/109] drm/amdgpu: Check extended configuration space register when system uses large bar Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 004/109] drm/amdgpu: disable BAR resize on Dell G5 SE Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 005/109] cpuidle, intel_idle: Fix CPUIDLE_FLAG_IBRS Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 006/109] x86/speculation: Add __update_spec_ctrl() helper Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 007/109] x86/amd_nb: Use rdmsr_safe() in amd_get_mmconfig_range() Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 008/109] Revert "of: reserved-memory: Fix using wrong number of cells to get property alignment" Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 009/109] LoongArch: Convert unreachable() to BUG() Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 010/109] HID: appleir: Fix potential NULL dereference at raw event handle Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 011/109] ksmbd: fix type confusion via race condition when using ipc_msg_send_request Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 012/109] ksmbd: fix use-after-free in smb2_lock Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 013/109] ksmbd: fix bug on trap " Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 014/109] gpio: rcar: Use raw_spinlock to protect register access Greg Kroah-Hartman
2025-03-10 17:05 ` [PATCH 6.1 015/109] gpio: aggregator: protect driver attr handlers against module unload Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 016/109] ALSA: hda: intel: Add Dell ALC3271 to power_save denylist Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 017/109] ALSA: hda/realtek - add supported Mic Mute LED for Lenovo platform Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 018/109] ALSA: hda/realtek: update ALC222 depop optimize Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 019/109] drm/amd/display: Fix null check for pipe_ctx->plane_state in resource_build_scaling_params Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 020/109] drm/radeon: Fix rs400_gpu_init for ATI mobility radeon Xpress 200M Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 021/109] platform/x86: thinkpad_acpi: Add battery quirk for ThinkPad X131e Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 022/109] x86/cacheinfo: Validate CPUID leaf 0x2 EDX output Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 023/109] x86/cpu: " Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 024/109] x86/cpu: Properly parse CPUID leaf 0x2 TLB descriptor 0x63 Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 025/109] mptcp: fix scheduling while atomic in mptcp_pm_nl_append_new_local_addr Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 026/109] Bluetooth: Add check for mgmt_alloc_skb() in mgmt_remote_name() Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 027/109] Bluetooth: Add check for mgmt_alloc_skb() in mgmt_device_connected() Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 028/109] wifi: cfg80211: regulatory: improve invalid hints checking Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 029/109] wifi: nl80211: reject cooked mode if it is set along with other flags Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 030/109] rapidio: add check for rio_add_net() in rio_scan_alloc_net() Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 031/109] rapidio: fix an API misues when rio_add_net() fails Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 032/109] dma: kmsan: export kmsan_handle_dma() for modules Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 033/109] s390/traps: Fix test_monitor_call() inline assembly Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 034/109] block: fix conversion of GPT partition name to 7-bit Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 035/109] mm/page_alloc: fix uninitialized variable Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 036/109] mm: dont skip arch_sync_kernel_mappings() in error paths Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 037/109] wifi: iwlwifi: limit printed string from FW file Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 038/109] HID: google: fix unused variable warning under !CONFIG_ACPI Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 039/109] HID: intel-ish-hid: Fix use-after-free issue in ishtp_hid_remove() Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 040/109] bluetooth: btusb: Initialize .owner field of force_poll_sync_fops Greg Kroah-Hartman
2025-03-10 17:06 ` Greg Kroah-Hartman [this message]
2025-03-10 17:06 ` [PATCH 6.1 042/109] net: gso: fix ownership in __udp_gso_segment Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 043/109] caif_virtio: fix wrong pointer check in cfv_probe() Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 044/109] hwmon: (pmbus) Initialise page count in pmbus_identify() Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 045/109] hwmon: (ntc_thermistor) Fix the ncpXXxh103 sensor table Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 046/109] hwmon: (ad7314) Validate leading zero bits and return error Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 047/109] ALSA: usx2y: validate nrpacks module parameter on probe Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 048/109] llc: do not use skb_get() before dev_queue_xmit() Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 049/109] hwmon: fix a NULL vs IS_ERR_OR_NULL() check in xgene_hwmon_probe() Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 050/109] drm/sched: Fix preprocessor guard Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 051/109] be2net: fix sleeping while atomic bugs in be_ndo_bridge_getlink Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 052/109] net: hns3: make sure ptp clock is unregister and freed if hclge_ptp_get_cycle returns an error Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 053/109] ppp: Fix KMSAN uninit-value warning with bpf Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 054/109] vlan: enforce underlying device type Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 055/109] x86/sgx: Fix size overflows in sgx_encl_create() Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 056/109] exfat: fix soft lockup in exfat_clear_bitmap Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 057/109] net-timestamp: support TCP GSO case for a few missing flags Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 058/109] ublk: set_params: properly check if parameters can be applied Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 059/109] sched/fair: Fix potential memory corruption in child_cfs_rq_on_list Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 060/109] net: ipv6: fix dst ref loop in ila lwtunnel Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 061/109] net: ipv6: fix missing dst ref drop " Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 062/109] gpio: rcar: Fix missing of_node_put() call Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 063/109] Revert "drivers/card_reader/rtsx_usb: Restore interrupt based detection" Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 064/109] usb: renesas_usbhs: Call clk_put() Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 065/109] usb: renesas_usbhs: Use devm_usb_get_phy() Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 066/109] usb: hub: lack of clearing xHC resources Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 067/109] usb: quirks: Add DELAY_INIT and NO_LPM for Prolific Mass Storage Card Reader Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 068/109] usb: renesas_usbhs: Flush the notify_hotplug_work Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 069/109] usb: atm: cxacru: fix a flaw in existing endpoint checks Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 070/109] usb: dwc3: Set SUSPENDENABLE soon after phy init Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 071/109] usb: dwc3: gadget: Prevent irq storm when TH re-executes Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 072/109] usb: typec: ucsi: increase timeout for PPM reset operations Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 073/109] usb: typec: tcpci_rt1711h: Unmask alert interrupts to fix functionality Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 074/109] usb: gadget: Set self-powered based on MaxPower and bmAttributes Greg Kroah-Hartman
2025-03-10 17:06 ` [PATCH 6.1 075/109] usb: gadget: Fix setting self-powered state on suspend Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 076/109] usb: gadget: Check bmAttributes only if configuration is valid Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 077/109] xhci: pci: Fix indentation in the PCI device ID definitions Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 078/109] usb: xhci: Enable the TRB overfetch quirk on VIA VL805 Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 079/109] KVM: SVM: Drop DEBUGCTL[5:2] from guests effective value Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 080/109] mei: me: add panther lake P DID Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 081/109] intel_th: pci: Add Arrow Lake support Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 082/109] intel_th: pci: Add Panther Lake-H support Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 083/109] intel_th: pci: Add Panther Lake-P/U support Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 084/109] drivers: core: fix device leak in __fw_devlink_relax_cycles() Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 085/109] slimbus: messaging: Free transaction ID in delayed interrupt scenario Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 086/109] bus: mhi: host: pci_generic: Use pci_try_reset_function() to avoid deadlock Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 087/109] eeprom: digsy_mtc: Make GPIO lookup table match the device Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 088/109] drivers: virt: acrn: hsm: Use kzalloc to avoid info leak in pmcmd_ioctl Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 089/109] iio: filter: admv8818: Force initialization of SDO Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 090/109] iio: dac: ad3552r: clear reset status flag Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 091/109] iio: adc: at91-sama5d2_adc: fix sama7g5 realbits value Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 092/109] ALSA: hda: realtek: fix incorrect IS_REACHABLE() usage Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 093/109] Revert "KVM: e500: always restore irqs" Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 094/109] Revert "KVM: PPC: e500: Use __kvm_faultin_pfn() to handle page faults" Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 095/109] Revert "KVM: PPC: e500: Mark "struct page" pfn accessed before dropping mmu_lock" Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 096/109] Revert "KVM: PPC: e500: Mark "struct page" dirty in kvmppc_e500_shadow_map()" Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 097/109] uprobes: Fix race in uprobe_free_utask Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 098/109] x86/mm: Dont disable PCID when INVLPG has been fixed by microcode Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 099/109] spi-mxs: Fix chipselect glitch Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 100/109] nilfs2: move page release outside of nilfs_delete_entry and nilfs_set_link Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 101/109] nilfs2: eliminate staggered calls to kunmap in nilfs_rename Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 102/109] nilfs2: handle errors that nilfs_prepare_chunk() may return Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 103/109] scsi: lpfc: Fix a possible data race in lpfc_unregister_fcf_rescan() Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 104/109] media: mediatek: vcodec: Handle invalid decoder vsi Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 105/109] fs/ntfs3: Add rough attr alloc_size check Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 106/109] bpf, vsock: Invoke proto::close on close() Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 107/109] vsock: Keep the binding until socket destruction Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 108/109] vsock: Orphan socket after transport release Greg Kroah-Hartman
2025-03-10 17:07 ` [PATCH 6.1 109/109] kbuild: userprogs: use correct lld when linking through clang Greg Kroah-Hartman
2025-03-10 19:02 ` [PATCH 6.1 000/109] 6.1.131-rc1 review SeongJae Park
2025-03-10 19:26 ` Florian Fainelli
2025-03-11 9:58 ` Jon Hunter
2025-03-11 9:59 ` Naresh Kamboju
2025-03-11 10:19 ` Ron Economos
2025-03-11 13:26 ` Mark Brown
2025-03-11 19:07 ` Pavel Machek
2025-03-11 19:41 ` Shuah Khan
2025-03-11 22:05 ` Peter Schneider
2025-03-12 17:12 ` Hardik Garg
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=20250310170429.192614390@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=kbusch@kernel.org \
--cc=meir.elisha@volumez.com \
--cc=patches@lists.linux.dev \
--cc=sagi@grimberg.me \
--cc=sashal@kernel.org \
--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