linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Huy Nguyen <huyn@mellanox.com>,
	Boris Pismenny <borisp@mellanox.com>,
	Raed Salem <raeds@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 061/131] xfrm: Fix double ESP trailer insertion in IPsec crypto offload.
Date: Mon, 29 Jun 2020 11:33:52 -0400	[thread overview]
Message-ID: <20200629153502.2494656-62-sashal@kernel.org> (raw)
In-Reply-To: <20200629153502.2494656-1-sashal@kernel.org>

From: Huy Nguyen <huyn@mellanox.com>

[ Upstream commit 94579ac3f6d0820adc83b5dc5358ead0158101e9 ]

During IPsec performance testing, we see bad ICMP checksum. The error packet
has duplicated ESP trailer due to double validate_xmit_xfrm calls. The first call
is from ip_output, but the packet cannot be sent because
netif_xmit_frozen_or_stopped is true and the packet gets dev_requeue_skb. The second
call is from NET_TX softirq. However after the first call, the packet already
has the ESP trailer.

Fix by marking the skb with XFRM_XMIT bit after the packet is handled by
validate_xmit_xfrm to avoid duplicate ESP trailer insertion.

Fixes: f6e27114a60a ("net: Add a xfrm validate function to validate_xmit_skb")
Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Raed Salem <raeds@mellanox.com>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/net/xfrm.h     | 1 +
 net/xfrm/xfrm_device.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 48dc1ce2170d8..f087c8d125b8f 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1083,6 +1083,7 @@ struct xfrm_offload {
 #define	XFRM_GRO		32
 #define	XFRM_ESP_NO_TRAILER	64
 #define	XFRM_DEV_RESUME		128
+#define	XFRM_XMIT		256
 
 	__u32			status;
 #define CRYPTO_SUCCESS				1
diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
index 8634ce6771421..e7a0ce98479f3 100644
--- a/net/xfrm/xfrm_device.c
+++ b/net/xfrm/xfrm_device.c
@@ -33,7 +33,7 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
 	netdev_features_t esp_features = features;
 	struct xfrm_offload *xo = xfrm_offload(skb);
 
-	if (!xo)
+	if (!xo || (xo->flags & XFRM_XMIT))
 		return skb;
 
 	if (!(features & NETIF_F_HW_ESP))
@@ -53,6 +53,8 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
 		return skb;
 	}
 
+	xo->flags |= XFRM_XMIT;
+
 	if (skb_is_gso(skb)) {
 		struct net_device *dev = skb->dev;
 
-- 
2.25.1


  parent reply	other threads:[~2020-06-29 20:02 UTC|newest]

Thread overview: 148+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 15:32 [PATCH 4.19 000/131] 4.19.131-rc1 review Sasha Levin
2020-06-29 15:32 ` [PATCH 4.19 001/131] net: be more gentle about silly gso requests coming from user Sasha Levin
2020-06-29 15:32 ` [PATCH 4.19 002/131] block/bio-integrity: don't free 'buf' if bio_integrity_add_page() failed Sasha Levin
2020-06-29 15:32 ` [PATCH 4.19 003/131] fanotify: fix ignore mask logic for events on child and on dir Sasha Levin
2020-06-29 15:32 ` [PATCH 4.19 004/131] mtd: rawnand: marvell: Fix the condition on a return code Sasha Levin
2020-06-29 15:32 ` [PATCH 4.19 005/131] net: bcmgenet: remove HFB_CTRL access Sasha Levin
2020-06-29 15:32 ` [PATCH 4.19 006/131] net: sched: export __netdev_watchdog_up() Sasha Levin
2020-06-29 15:32 ` [PATCH 4.19 007/131] EDAC/amd64: Add Family 17h Model 30h PCI IDs Sasha Levin
2020-06-29 15:32 ` [PATCH 4.19 008/131] i2c: tegra: Cleanup kerneldoc comments Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 009/131] i2c: tegra: Add missing kerneldoc for some fields Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 010/131] i2c: tegra: Fix Maximum transfer size Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 011/131] btrfs: make caching_thread use btrfs_find_next_key Sasha Levin
2020-06-30 21:09   ` Pavel Machek
2020-07-01  3:21     ` Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 012/131] fix a braino in "sparc32: fix register window handling in genregs32_[gs]et()" Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 013/131] ALSA: hda/realtek - Enable the headset of ASUS B9450FA with ALC294 Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 014/131] ALSA: hda/realtek: Enable mute LED on an HP system Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 015/131] ALSA: hda/realtek - Enable micmute LED on and " Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 016/131] apparmor: don't try to replace stale label in ptraceme check Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 017/131] ibmveth: Fix max MTU limit Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 018/131] mld: fix memory leak in ipv6_mc_destroy_dev() Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 019/131] net: bridge: enfore alignment for ethernet address Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 020/131] net: fix memleak in register_netdevice() Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 021/131] net: place xmit recursion in softnet data Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 022/131] net: use correct this_cpu primitive in dev_recursion_level Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 023/131] net: increment xmit_recursion level in dev_direct_xmit() Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 024/131] net: usb: ax88179_178a: fix packet alignment padding Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 025/131] rocker: fix incorrect error handling in dma_rings_init Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 026/131] rxrpc: Fix notification call on completion of discarded calls Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 027/131] sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 028/131] tcp: don't ignore ECN CWR on pure ACK Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 029/131] tcp: grow window for OOO packets only for SACK flows Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 030/131] tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 031/131] ip6_gre: fix use-after-free in ip6gre_tunnel_lookup() Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 032/131] net: phy: Check harder for errors in get_phy_id() Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 033/131] ip_tunnel: fix use-after-free in ip_tunnel_lookup() Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 034/131] sch_cake: don't try to reallocate or unshare skb unconditionally Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 035/131] sch_cake: fix a few style nits Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 036/131] tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 037/131] sch_cake: don't call diffserv parsing code when it is not needed Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 038/131] net: Fix the arp error in some cases Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 039/131] net: Do not clear the sock TX queue in sk_set_socket() Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 040/131] net: core: reduce recursion limit value Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 041/131] USB: ohci-sm501: Add missed iounmap() in remove Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 042/131] usb: dwc2: Postponed gadget registration to the udc class driver Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 043/131] usb: add USB_QUIRK_DELAY_INIT for Logitech C922 Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 044/131] USB: ehci: reopen solution for Synopsys HC bug Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 045/131] usb: host: xhci-mtk: avoid runtime suspend when removing hcd Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 046/131] xhci: Poll for U0 after disabling USB2 LPM Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 047/131] usb: host: ehci-exynos: Fix error check in exynos_ehci_probe() Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 048/131] usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 049/131] ALSA: usb-audio: add quirk for Denon DCD-1500RE Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 050/131] ALSA: usb-audio: add quirk for Samsung USBC Headset (AKG) Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 051/131] ALSA: usb-audio: Fix OOB access of mixer element list Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 052/131] scsi: zfcp: Fix panic on ERP timeout for previously dismissed ERP action Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 053/131] xhci: Fix incorrect EP_STATE_MASK Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 054/131] xhci: Fix enumeration issue when setting max packet size for FS devices Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 055/131] xhci: Return if xHCI doesn't support LPM Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 056/131] cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 057/131] loop: replace kill_bdev with invalidate_bdev Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 058/131] IB/mad: Fix use after free when destroying MAD agent Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 059/131] cifs/smb3: Fix data inconsistent when punch hole Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 060/131] cifs/smb3: Fix data inconsistent when zero file range Sasha Levin
2020-06-29 15:33 ` Sasha Levin [this message]
2020-06-29 15:33 ` [PATCH 4.19 062/131] ASoC: q6asm: handle EOS correctly Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 063/131] efi/esrt: Fix reference count leak in esre_create_sysfs_entry Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 064/131] regualtor: pfuze100: correct sw1a/sw2 on pfuze3000 Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 065/131] ASoC: fsl_ssi: Fix bclk calculation for mono channel Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 066/131] ARM: dts: Fix duovero smsc interrupt for suspend Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 067/131] x86/resctrl: Fix a NULL vs IS_ERR() static checker warning in rdt_cdp_peer_get() Sasha Levin
2020-06-29 15:33 ` [PATCH 4.19 068/131] regmap: Fix memory leak from regmap_register_patch Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 069/131] ARM: dts: NSP: Correct FA2 mailbox node Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 070/131] rxrpc: Fix handling of rwind from an ACK packet Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 071/131] RDMA/qedr: Fix KASAN: use-after-free in ucma_event_handler+0x532 Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 072/131] RDMA/cma: Protect bind_list and listen_list while finding matching cm id Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 073/131] ASoC: rockchip: Fix a reference count leak Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 074/131] RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads() Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 075/131] net: qed: fix left elements count calculation Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 076/131] net: qed: fix NVMe login fails over VFs Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 077/131] net: qed: fix excessive QM ILT lines consumption Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 078/131] cxgb4: move handling L2T ARP failures to caller Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 079/131] ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram() Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 080/131] usb: gadget: udc: Potential Oops in error handling code Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 081/131] nvme-multipath: set bdi capabilities once Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 082/131] nvme: fix possible deadlock when I/O is blocked Sasha Levin
2020-07-02 21:17   ` Pavel Machek
2020-07-02 22:15     ` Sagi Grimberg
2020-06-29 15:34 ` [PATCH 4.19 083/131] nvme-multipath: fix deadlock between ana_work and scan_work Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 084/131] netfilter: ipset: fix unaligned atomic access Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 085/131] net: bcmgenet: use hardware padding of runt frames Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 086/131] i2c: fsi: Fix the port number field in status register Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 087/131] i2c: core: check returned size of emulated smbus block read Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 088/131] sched/deadline: Initialize ->dl_boosted Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 089/131] sched/core: Fix PI boosting between RT and DEADLINE tasks Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 090/131] sata_rcar: handle pm_runtime_get_sync failure cases Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 091/131] ata/libata: Fix usage of page address by page_address in ata_scsi_mode_select_xlat function Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 092/131] drm/amd/display: Use kfree() to free rgb_user in calculate_user_regamma_ramp() Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 093/131] riscv/atomic: Fix sign extension for RV64I Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 094/131] hwrng: ks-sa - Fix runtime PM imbalance on error Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 095/131] arm64/sve: Eliminate data races on sve_default_vl Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 096/131] ibmvnic: Harden device login requests Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 097/131] net: alx: fix race condition in alx_remove Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 098/131] s390/ptrace: fix setting syscall number Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 099/131] s390/vdso: fix vDSO clock_getres() Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 100/131] arm64: sve: Fix build failure when ARM64_SVE=y and SYSCTL=n Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 101/131] kbuild: improve cc-option to clean up all temporary files Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 102/131] blktrace: break out of blktrace setup on concurrent calls Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 103/131] RISC-V: Don't allow write+exec only page mapping request in mmap Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 104/131] ALSA: hda: Add NVIDIA codec IDs 9a & 9d through a0 to patch table Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 105/131] ALSA: hda/realtek - Add quirk for MSI GE63 laptop Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 106/131] ACPI: sysfs: Fix pm_profile_attr type Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 107/131] erofs: fix partially uninitialized misuse in z_erofs_onlinepage_fixup Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 108/131] KVM: X86: Fix MSR range of APIC registers in X2APIC mode Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 109/131] KVM: nVMX: Plumb L2 GPA through to PML emulation Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 110/131] x86/asm/64: Align start of __clear_user() loop to 16-bytes Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 111/131] btrfs: fix data block group relocation failure due to concurrent scrub Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 112/131] btrfs: fix failure of RWF_NOWAIT write into prealloc extent beyond eof Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 113/131] mm/slab: use memzero_explicit() in kzfree() Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 114/131] ocfs2: avoid inode removal while nfsd is accessing it Sasha Levin
2020-07-02 21:17   ` Pavel Machek
2020-07-02 22:24     ` Linus Torvalds
2020-07-05  1:49       ` Junxiao Bi
2020-06-29 15:34 ` [PATCH 4.19 115/131] ocfs2: load global_inode_alloc Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 116/131] ocfs2: fix value of OCFS2_INVALID_SLOT Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 117/131] ocfs2: fix panic on nfs server over ocfs2 Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 118/131] arm64: perf: Report the PC value in REGS_ABI_32 mode Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 119/131] tracing: Fix event trigger to accept redundant spaces Sasha Levin
2020-07-02 21:17   ` Pavel Machek
2020-07-03  6:04     ` Greg Kroah-Hartman
2020-07-03 19:21       ` Pavel Machek
2020-07-05 13:30         ` Sasha Levin
2020-07-03 11:40     ` Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 120/131] ring-buffer: Zero out time extend if it is nested and not absolute Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 121/131] drm: rcar-du: Fix build error Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 122/131] drm/radeon: fix fb_div check in ni_init_smc_spll_table() Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 123/131] Staging: rtl8723bs: prevent buffer overflow in update_sta_support_rate() Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 124/131] sunrpc: fixed rollback in rpc_gssd_dummy_populate() Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 125/131] SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment() Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 126/131] pNFS/flexfiles: Fix list corruption if the mirror count changes Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 127/131] NFSv4 fix CLOSE not waiting for direct IO compeletion Sasha Levin
2020-06-29 15:34 ` [PATCH 4.19 128/131] dm writecache: correct uncommitted_block when discarding uncommitted entry Sasha Levin
2020-06-29 15:35 ` [PATCH 4.19 129/131] dm writecache: add cond_resched to loop in persistent_memory_claim() Sasha Levin
2020-06-29 15:35 ` [PATCH 4.19 130/131] xfs: add agf freeblocks verify in xfs_agf_verify Sasha Levin
2020-06-29 15:35 ` [PATCH 4.19 131/131] Linux 4.19.131-rc1 Sasha Levin
2020-06-30  5:29 ` [PATCH 4.19 000/131] 4.19.131-rc1 review Naresh Kamboju
2020-06-30  9:14 ` Jon Hunter
2020-06-30 16:03 ` Chris Paterson
2020-06-30 17:21 ` Guenter Roeck

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=20200629153502.2494656-62-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=borisp@mellanox.com \
    --cc=huyn@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raeds@mellanox.com \
    --cc=saeedm@mellanox.com \
    --cc=stable@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    /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;
as well as URLs for NNTP newsgroup(s).