From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Zheng Wang <zyytlz.wz@163.com>,
Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
Eric Van Hensbergen <ericvh@kernel.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.4 57/92] 9p/xen : Fix use after free bug in xen_9pfs_front_remove due to race condition
Date: Tue, 18 Apr 2023 14:21:32 +0200 [thread overview]
Message-ID: <20230418120306.840095281@linuxfoundation.org> (raw)
In-Reply-To: <20230418120304.658273364@linuxfoundation.org>
From: Zheng Wang <zyytlz.wz@163.com>
[ Upstream commit ea4f1009408efb4989a0f139b70fb338e7f687d0 ]
In xen_9pfs_front_probe, it calls xen_9pfs_front_alloc_dataring
to init priv->rings and bound &ring->work with p9_xen_response.
When it calls xen_9pfs_front_event_handler to handle IRQ requests,
it will finally call schedule_work to start the work.
When we call xen_9pfs_front_remove to remove the driver, there
may be a sequence as follows:
Fix it by finishing the work before cleanup in xen_9pfs_front_free.
Note that, this bug is found by static analysis, which might be
false positive.
CPU0 CPU1
|p9_xen_response
xen_9pfs_front_remove|
xen_9pfs_front_free|
kfree(priv) |
//free priv |
|p9_tag_lookup
|//use priv->client
Fixes: 71ebd71921e4 ("xen/9pfs: connect to the backend")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/9p/trans_xen.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index 67e9a7085e13b..4a16c5dd1576d 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -299,6 +299,10 @@ static void xen_9pfs_front_free(struct xen_9pfs_front_priv *priv)
write_unlock(&xen_9pfs_lock);
for (i = 0; i < priv->num_rings; i++) {
+ struct xen_9pfs_dataring *ring = &priv->rings[i];
+
+ cancel_work_sync(&ring->work);
+
if (!priv->rings[i].intf)
break;
if (priv->rings[i].irq > 0)
--
2.39.2
next prev parent reply other threads:[~2023-04-18 12:30 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 12:20 [PATCH 5.4 00/92] 5.4.241-rc1 review Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 01/92] scsi: ses: Handle enclosure with just a primary component gracefully Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 02/92] x86/PCI: Add quirk for AMD XHCI controller that loses MSI-X state in D3hot Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 03/92] cgroup/cpuset: Wake up cpuset_attach_wq tasks in cpuset_cancel_attach() Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 04/92] Revert "treewide: Replace DECLARE_TASKLET() with DECLARE_TASKLET_OLD()" Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 05/92] treewide: Replace DECLARE_TASKLET() with DECLARE_TASKLET_OLD() Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 06/92] smb3: fix problem with null cifs super block with previous patch Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 07/92] pinctrl: amd: Use irqchip template Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 08/92] pinctrl: amd: disable and mask interrupts on probe Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 09/92] pinctrl: amd: Disable and mask interrupts on resume Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 10/92] pwm: cros-ec: Explicitly set .polarity in .get_state() Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 11/92] pwm: sprd: " Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 12/92] wifi: mac80211: fix invalid drv_sta_pre_rcu_remove calls for non-uploaded sta Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 13/92] icmp: guard against too small mtu Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 14/92] net: dont let netpoll invoke NAPI if in xmit context Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 15/92] sctp: check send stream number after wait_for_sndbuf Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 16/92] ipv6: Fix an uninit variable access bug in __ip6_make_skb() Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 17/92] gpio: davinci: Add irq chip flag to skip set wake Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 18/92] sunrpc: only free unix grouplist after RCU settles Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 19/92] NFSD: callback request does not use correct credential for AUTH_SYS Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 20/92] xhci: also avoid the XHCI_ZERO_64B_REGS quirk with a passthrough iommu Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 21/92] USB: serial: cp210x: add Silicon Labs IFS-USB-DATACABLE IDs Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 22/92] usb: typec: altmodes/displayport: Fix configure initial pin assignment Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 23/92] USB: serial: option: add Telit FE990 compositions Greg Kroah-Hartman
2023-04-18 12:20 ` [PATCH 5.4 24/92] USB: serial: option: add Quectel RM500U-CN modem Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 25/92] iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chip Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 26/92] iio: dac: cio-dac: Fix max DAC write value check for 12-bit Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 27/92] tty: serial: sh-sci: Fix transmit end interrupt handler Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 28/92] tty: serial: sh-sci: Fix Rx on RZ/G2L SCI Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 29/92] tty: serial: fsl_lpuart: avoid checking for transfer complete when UARTCTRL_SBK is asserted in lpuart32_tx_empty Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 30/92] nilfs2: fix potential UAF of struct nilfs_sc_info in nilfs_segctor_thread() Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 31/92] nilfs2: fix sysfs interface lifetime Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 32/92] ALSA: hda/realtek: Add quirk for Clevo X370SNW Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 33/92] perf/core: Fix the same task check in perf_event_set_output Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 34/92] ftrace: Mark get_lock_parent_ip() __always_inline Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 35/92] can: j1939: j1939_tp_tx_dat_new(): fix out-of-bounds memory access Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 36/92] tracing: Free error logs of tracing instances Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 37/92] net_sched: prevent NULL dereference if default qdisc setup failed Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 38/92] drm/panfrost: Fix the panfrost_mmu_map_fault_addr() error path Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 39/92] ring-buffer: Fix race while reader and writer are on the same page Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 40/92] mm/swap: fix swap_info_struct race between swapoff and get_swap_pages() Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 41/92] irqdomain: Look for existing mapping only once Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 42/92] irqdomain: Refactor __irq_domain_alloc_irqs() Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 43/92] irqdomain: Fix mapping-creation race Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 44/92] Revert "pinctrl: amd: Disable and mask interrupts on resume" Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 45/92] ALSA: emu10k1: fix capture interrupt handler unlinking Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 46/92] ALSA: hda/sigmatel: add pin overrides for Intel DP45SG motherboard Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 47/92] ALSA: i2c/cs8427: fix iec958 mixer control deactivation Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 48/92] ALSA: firewire-tascam: add missing unwind goto in snd_tscm_stream_start_duplex() Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 49/92] ALSA: hda/sigmatel: fix S/PDIF out on Intel D*45* motherboards Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 50/92] Bluetooth: L2CAP: Fix use-after-free in l2cap_disconnect_{req,rsp} Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 51/92] Bluetooth: Fix race condition in hidp_session_thread Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 52/92] btrfs: print checksum type and implementation at mount time Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 53/92] btrfs: fix fast csum implementation detection Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 54/92] mtdblock: tolerate corrected bit-flips Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 55/92] mtd: rawnand: meson: fix bitmask for length in command word Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 56/92] mtd: rawnand: stm32_fmc2: remove unsupported EDO mode Greg Kroah-Hartman
2023-04-18 12:21 ` Greg Kroah-Hartman [this message]
2023-04-18 12:21 ` [PATCH 5.4 58/92] niu: Fix missing unwind goto in niu_alloc_channels() Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 59/92] qlcnic: check pci_reset_function result Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 60/92] sctp: fix a potential overflow in sctp_ifwdtsn_skip Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 61/92] RDMA/core: Fix GID entry ref leak when create_ah fails Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 62/92] udp6: fix potential access to stale information Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 63/92] net: macb: fix a memory corruption in extended buffer descriptor mode Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 64/92] power: supply: cros_usbpd: reclassify "default case!" as debug Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 65/92] i2c: imx-lpi2c: clean rx/tx buffers upon new message Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 66/92] efi: sysfb_efi: Add quirk for Lenovo Yoga Book X91F/L Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 67/92] drm: panel-orientation-quirks: Add quirk for Lenovo Yoga Book X90F Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 68/92] verify_pefile: relax wrapper length check Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 69/92] asymmetric_keys: log on fatal failures in PE/pkcs7 Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 70/92] ubi: Fix failure attaching when vid_hdr offset equals to (sub)page size Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 71/92] mtd: ubi: wl: Fix a couple of kernel-doc issues Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 72/92] ubi: Fix deadlock caused by recursively holding work_sem Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 73/92] i2c: ocores: generate stop condition after timeout in polling mode Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 74/92] watchdog: sbsa_wdog: Make sure the timeout programming is within the limits Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 75/92] coresight-etm4: Fix for() loop drvdata->nr_addr_cmp range bug Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 76/92] xfs: show the proper user quota options Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 77/92] xfs: merge the projid fields in struct xfs_icdinode Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 78/92] xfs: ensure that the inode uid/gid match values match the icdinode ones Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 79/92] xfs: remove the icdinode di_uid/di_gid members Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 80/92] xfs: remove the kuid/kgid conversion wrappers Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 81/92] xfs: add a new xfs_sb_version_has_v3inode helper Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 82/92] xfs: only check the superblock version for dinode size calculation Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 83/92] xfs: simplify di_flags2 inheritance in xfs_ialloc Greg Kroah-Hartman
2023-04-18 12:21 ` [PATCH 5.4 84/92] xfs: simplify a check in xfs_ioctl_setattr_check_cowextsize Greg Kroah-Hartman
2023-04-18 12:22 ` [PATCH 5.4 85/92] xfs: remove the di_version field from struct icdinode Greg Kroah-Hartman
2023-04-18 12:22 ` [PATCH 5.4 86/92] xfs: fix up non-directory creation in SGID directories Greg Kroah-Hartman
2023-04-18 12:22 ` [PATCH 5.4 87/92] xfs: set inode size after creating symlink Greg Kroah-Hartman
2023-04-18 12:22 ` [PATCH 5.4 88/92] xfs: report corruption only as a regular error Greg Kroah-Hartman
2023-04-18 12:22 ` [PATCH 5.4 89/92] xfs: shut down the filesystem if we screw up quota reservation Greg Kroah-Hartman
2023-04-18 12:22 ` [PATCH 5.4 90/92] xfs: consider shutdown in bmapbt cursor delete assert Greg Kroah-Hartman
2023-04-18 12:22 ` [PATCH 5.4 91/92] xfs: dont reuse busy extents on extent trim Greg Kroah-Hartman
2023-04-18 12:22 ` [PATCH 5.4 92/92] xfs: force log and push AIL to clear pinned inodes when aborting mount Greg Kroah-Hartman
2023-04-18 14:12 ` [PATCH 5.4 00/92] 5.4.241-rc1 review Chris Paterson
2023-04-18 16:36 ` Florian Fainelli
2023-04-18 21:28 ` Shuah Khan
2023-04-19 3:34 ` Guenter Roeck
2023-04-19 7:41 ` Naresh Kamboju
2023-04-19 7:58 ` Cyril Hrubis
2023-04-21 8:04 ` Petr Vorel
2023-04-24 6:36 ` Yang Xu (Fujitsu)
2023-04-19 12:37 ` Harshit Mogalapalli
2023-04-19 13:30 ` zhouzhixiu
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=20230418120306.840095281@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=ericvh@kernel.org \
--cc=michal.swiatkowski@linux.intel.com \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=zyytlz.wz@163.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).