linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	syzbot+174de899852504e4a74a@syzkaller.appspotmail.com,
	syzbot+3d1c772efafd3c38d007@syzkaller.appspotmail.com,
	David Howells <dhowells@redhat.com>,
	Hillf Danton <hdanton@sina.com>, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH 5.10 087/104] rxrpc: Fix clearance of Tx/Rx ring when releasing a call
Date: Mon, 15 Feb 2021 16:27:40 +0100	[thread overview]
Message-ID: <20210215152722.264884406@linuxfoundation.org> (raw)
In-Reply-To: <20210215152719.459796636@linuxfoundation.org>

From: David Howells <dhowells@redhat.com>

commit 7b5eab57cac45e270a0ad624ba157c5b30b3d44d upstream.

At the end of rxrpc_release_call(), rxrpc_cleanup_ring() is called to clear
the Rx/Tx skbuff ring, but this doesn't lock the ring whilst it's accessing
it.  Unfortunately, rxrpc_resend() might be trying to retransmit a packet
concurrently with this - and whilst it does lock the ring, this isn't
protection against rxrpc_cleanup_call().

Fix this by removing the call to rxrpc_cleanup_ring() from
rxrpc_release_call().  rxrpc_cleanup_ring() will be called again anyway
from rxrpc_cleanup_call().  The earlier call is just an optimisation to
recycle skbuffs more quickly.

Alternative solutions include rxrpc_release_call() could try to cancel the
work item or wait for it to complete or rxrpc_cleanup_ring() could lock
when accessing the ring (which would require a bh lock).

This can produce a report like the following:

  BUG: KASAN: use-after-free in rxrpc_send_data_packet+0x19b4/0x1e70 net/rxrpc/output.c:372
  Read of size 4 at addr ffff888011606e04 by task kworker/0:0/5
  ...
  Workqueue: krxrpcd rxrpc_process_call
  Call Trace:
   ...
   kasan_report.cold+0x79/0xd5 mm/kasan/report.c:413
   rxrpc_send_data_packet+0x19b4/0x1e70 net/rxrpc/output.c:372
   rxrpc_resend net/rxrpc/call_event.c:266 [inline]
   rxrpc_process_call+0x1634/0x1f60 net/rxrpc/call_event.c:412
   process_one_work+0x98d/0x15f0 kernel/workqueue.c:2275
   ...

  Allocated by task 2318:
   ...
   sock_alloc_send_pskb+0x793/0x920 net/core/sock.c:2348
   rxrpc_send_data+0xb51/0x2bf0 net/rxrpc/sendmsg.c:358
   rxrpc_do_sendmsg+0xc03/0x1350 net/rxrpc/sendmsg.c:744
   rxrpc_sendmsg+0x420/0x630 net/rxrpc/af_rxrpc.c:560
   ...

  Freed by task 2318:
   ...
   kfree_skb+0x140/0x3f0 net/core/skbuff.c:704
   rxrpc_free_skb+0x11d/0x150 net/rxrpc/skbuff.c:78
   rxrpc_cleanup_ring net/rxrpc/call_object.c:485 [inline]
   rxrpc_release_call+0x5dd/0x860 net/rxrpc/call_object.c:552
   rxrpc_release_calls_on_socket+0x21c/0x300 net/rxrpc/call_object.c:579
   rxrpc_release_sock net/rxrpc/af_rxrpc.c:885 [inline]
   rxrpc_release+0x263/0x5a0 net/rxrpc/af_rxrpc.c:916
   __sock_release+0xcd/0x280 net/socket.c:597
   ...

  The buggy address belongs to the object at ffff888011606dc0
   which belongs to the cache skbuff_head_cache of size 232

Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")
Reported-by: syzbot+174de899852504e4a74a@syzkaller.appspotmail.com
Reported-by: syzbot+3d1c772efafd3c38d007@syzkaller.appspotmail.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Hillf Danton <hdanton@sina.com>
Link: https://lore.kernel.org/r/161234207610.653119.5287360098400436976.stgit@warthog.procyon.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/rxrpc/call_object.c |    2 --
 1 file changed, 2 deletions(-)

--- a/net/rxrpc/call_object.c
+++ b/net/rxrpc/call_object.c
@@ -548,8 +548,6 @@ void rxrpc_release_call(struct rxrpc_soc
 		rxrpc_disconnect_call(call);
 	if (call->security)
 		call->security->free_call_crypto(call);
-
-	rxrpc_cleanup_ring(call);
 	_leave("");
 }
 



  parent reply	other threads:[~2021-02-15 16:47 UTC|newest]

Thread overview: 121+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 15:26 [PATCH 5.10 000/104] 5.10.17-rc1 review Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 001/104] objtool: Fix seg fault with Clang non-section symbols Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 002/104] Revert "dts: phy: add GPIO number and active state used for phy reset" Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 003/104] gpio: mxs: GPIO_MXS should not default to y unconditionally Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 004/104] gpio: ep93xx: fix BUG_ON port F usage Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 005/104] gpio: ep93xx: Fix single irqchip with multi gpiochips Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 006/104] tracing: Do not count ftrace events in top level enable output Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 007/104] tracing: Check length before giving out the filter buffer Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 008/104] drm/i915: Fix overlay frontbuffer tracking Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 009/104] arm/xen: Dont probe xenbus as part of an early initcall Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 010/104] cgroup: fix psi monitor for root cgroup Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 011/104] Revert "drm/amd/display: Update NV1x SR latency values" Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 012/104] drm/i915/tgl+: Make sure TypeC FIA is powered up when initializing it Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 013/104] drm/dp_mst: Dont report ports connected if nothing is attached to them Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 014/104] dmaengine: move channel device_node deletion to driver Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 015/104] tmpfs: disallow CONFIG_TMPFS_INODE64 on s390 Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 016/104] tmpfs: disallow CONFIG_TMPFS_INODE64 on alpha Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 017/104] soc: ti: omap-prm: Fix boot time errors for rst_map_012 bits 0 and 1 Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 018/104] arm64: dts: rockchip: Fix PCIe DT properties on rk3399 Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 019/104] arm64: dts: qcom: sdm845: Reserve LPASS clocks in gcc Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 020/104] ARM: OMAP2+: Fix suspcious RCU usage splats for omap_enter_idle_coupled Greg Kroah-Hartman
2021-02-19 21:14   ` Pavel Machek
2021-02-19 21:26     ` Paul E. McKenney
2021-02-15 15:26 ` [PATCH 5.10 021/104] arm64: dts: rockchip: remove interrupt-names property from rk3399 vdec node Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 022/104] kbuild: simplify GCC_PLUGINS enablement in dummy-tools/gcc Greg Kroah-Hartman
2021-02-17  9:08   ` Pavel Machek
2021-02-17  9:28     ` Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 023/104] platform/x86: hp-wmi: Disable tablet-mode reporting by default Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 024/104] arm64: dts: rockchip: Disable display for NanoPi R2S Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 025/104] ovl: perform vfs_getxattr() with mounter creds Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 026/104] cap: fix conversions on getxattr Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 027/104] ovl: skip getxattr of security labels Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 028/104] scsi: lpfc: Fix EEH encountering oops with NVMe traffic Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 029/104] x86/split_lock: Enable the split lock feature on another Alder Lake CPU Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 030/104] nvme-pci: ignore the subsysem NQN on Phison E16 Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 031/104] drm/amd/display: Fix DPCD translation for LTTPR AUX_RD_INTERVAL Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 032/104] drm/amd/display: Add more Clock Sources to DCN2.1 Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 033/104] drm/amd/display: Release DSC before acquiring Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 034/104] drm/amd/display: Fix dc_sink kref count in emulated_link_detect Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 035/104] drm/amd/display: Free atomic state after drm_atomic_commit Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 036/104] drm/amd/display: Decrement refcount of dc_sink before reassignment Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 037/104] riscv: virt_addr_valid must check the address belongs to linear mapping Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 038/104] bfq-iosched: Revert "bfq: Fix computation of shallow depth" Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 039/104] ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 040/104] kallsyms: fix nonconverging kallsyms table with lld Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 041/104] ARM: ensure the signal page contains defined contents Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 042/104] ARM: kexec: fix oops after TLB are invalidated Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 043/104] kasan: add explicit preconditions to kasan_report() Greg Kroah-Hartman
2021-02-16 11:50   ` Pavel Machek
2021-02-17  9:26     ` Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 044/104] ubsan: implement __ubsan_handle_alignment_assumption Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 045/104] Revert "lib: Restrict cpumask_local_spread to houskeeping CPUs" Greg Kroah-Hartman
2021-02-15 15:26 ` [PATCH 5.10 046/104] x86/efi: Remove EFI PGD build time checks Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 047/104] lkdtm: dont move ctors to .rodata Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 048/104] KVM: x86: cleanup CR3 reserved bits checks Greg Kroah-Hartman
2021-02-15 18:46   ` Pavel Machek
2021-02-15 19:04     ` Paolo Bonzini
2021-02-15 15:27 ` [PATCH 5.10 049/104] cgroup-v1: add disabled controller check in cgroup1_parse_param() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 050/104] dmaengine: idxd: fix misc interrupt completion Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 051/104] ath9k: fix build error with LEDS_CLASS=m Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 052/104] mt76: dma: fix a possible memory leak in mt76_add_fragment() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 053/104] drm/vc4: hvs: Fix buffer overflow with the dlist handling Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 054/104] dmaengine: idxd: check device state before issue command Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 055/104] bpf: Unbreak BPF_PROG_TYPE_KPROBE when kprobe is called via do_int3 Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 056/104] bpf: Check for integer overflow when using roundup_pow_of_two() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 057/104] netfilter: xt_recent: Fix attempt to update deleted entry Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 058/104] selftests: netfilter: fix current year Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 059/104] netfilter: nftables: fix possible UAF over chains from packet path in netns Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 060/104] netfilter: flowtable: fix tcp and udp header checksum update Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 061/104] xen/netback: avoid race in xenvif_rx_ring_slots_available() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 062/104] net: hdlc_x25: Return meaningful error code in x25_open Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 063/104] net: ipa: set error code in gsi_channel_setup() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 064/104] hv_netvsc: Reset the RSC count if NVSP_STAT_FAIL in netvsc_receive() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 065/104] net: enetc: initialize the RFS and RSS memories Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 066/104] selftests: txtimestamp: fix compilation issue Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 067/104] net: stmmac: set TxQ mode back to DCB after disabling CBS Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 068/104] ibmvnic: Clear failover_pending if unable to schedule Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 069/104] netfilter: conntrack: skip identical origin tuple in same zone only Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 070/104] scsi: scsi_debug: Fix a memory leak Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 071/104] x86/build: Disable CET instrumentation in the kernel for 32-bit too Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 072/104] net: dsa: felix: implement port flushing on .phylink_mac_link_down Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 073/104] net: hns3: add a check for queue_id in hclge_reset_vf_queue() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 074/104] net: hns3: add a check for tqp_index in hclge_get_ring_chain_from_mbx() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 075/104] net: hns3: add a check for index in hclge_get_rss_key() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 076/104] firmware_loader: align .builtin_fw to 8 Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 077/104] drm/sun4i: tcon: set sync polarity for tcon1 channel Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 078/104] drm/sun4i: dw-hdmi: always set clock rate Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 079/104] drm/sun4i: Fix H6 HDMI PHY configuration Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 080/104] drm/sun4i: dw-hdmi: Fix max. frequency for H6 Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 081/104] clk: sunxi-ng: mp: fix parent rate change flag check Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 082/104] i2c: stm32f7: fix configuration of the digital filter Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 083/104] h8300: fix PREEMPTION build, TI_PRE_COUNT undefined Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 084/104] scripts: set proper OpenSSL include dir also for sign-file Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 085/104] x86/pci: Create PCI/MSI irqdomain after x86_init.pci.arch_init() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 086/104] arm64: mte: Allow PTRACE_PEEKMTETAGS access to the zero page Greg Kroah-Hartman
2021-02-15 15:27 ` Greg Kroah-Hartman [this message]
2021-02-15 15:27 ` [PATCH 5.10 088/104] udp: fix skb_copy_and_csum_datagram with odd segment sizes Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 089/104] net: dsa: call teardown method on probe failure Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 090/104] cpufreq: ACPI: Extend frequency tables to cover boost frequencies Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 091/104] cpufreq: ACPI: Update arch scale-invariance max perf ratio if CPPC is not there Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 092/104] net: gro: do not keep too many GRO packets in napi->rx_list Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 093/104] net: fix iteration for sctp transport seq_files Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 094/104] net/vmw_vsock: fix NULL pointer dereference Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 095/104] net/vmw_vsock: improve locking in vsock_connect_timeout() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 096/104] net: watchdog: hold device global xmit lock during tx disable Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 097/104] bridge: mrp: Fix the usage of br_mrp_port_switchdev_set_state Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 098/104] switchdev: mrp: Remove SWITCHDEV_ATTR_ID_MRP_PORT_STAT Greg Kroah-Hartman
2021-02-16 21:35   ` Pavel Machek
2021-02-16 22:08     ` Horatiu Vultur
2021-02-17 19:27       ` Pavel Machek
2021-02-15 15:27 ` [PATCH 5.10 099/104] vsock/virtio: update credit only if socket is not closed Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 100/104] vsock: fix locking in vsock_shutdown() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 101/104] net/rds: restrict iovecs length for RDS_CMSG_RDMA_ARGS Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 102/104] net/qrtr: restrict user-controlled length in qrtr_tun_write_iter() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 103/104] ovl: expand warning in ovl_d_real() Greg Kroah-Hartman
2021-02-15 15:27 ` [PATCH 5.10 104/104] kcov, usb: only collect coverage from __usb_hcd_giveback_urb in softirq Greg Kroah-Hartman
2021-02-15 20:29 ` [PATCH 5.10 000/104] 5.10.17-rc1 review Pavel Machek
2021-02-16  4:08 ` Naresh Kamboju
2021-02-16 18:50 ` Guenter Roeck
2021-02-16 22:28 ` Shuah Khan
2021-02-17  1:19 ` Ross Schmidt

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=20210215152722.264884406@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=dhowells@redhat.com \
    --cc=hdanton@sina.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+174de899852504e4a74a@syzkaller.appspotmail.com \
    --cc=syzbot+3d1c772efafd3c38d007@syzkaller.appspotmail.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).