linux-stable/net/9p
Zheng Wang e35ae49bc1 9p/xen : Fix use after free bug in xen_9pfs_front_remove due to race condition
[ Upstream commit ea4f100940 ]

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: 71ebd71921 ("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>
2023-04-20 12:13:53 +02:00
..
client.c net/9p: fix bug in client create for .L 2023-03-22 13:31:31 +01:00
error.c 9p: fix a bunch of checkpatch warnings 2022-08-17 14:24:07 +02:00
Kconfig net: remove redundant 'depends on NET' 2021-01-27 17:04:12 -08:00
Makefile 9p: Remove p9_idpool 2018-08-29 13:39:57 +09:00
mod.c 9p: fix a bunch of checkpatch warnings 2022-08-17 14:24:07 +02:00
protocol.c 9p: fix a bunch of checkpatch warnings 2022-08-17 14:24:07 +02:00
protocol.h 9p: fix a bunch of checkpatch warnings 2022-08-17 14:24:07 +02:00
trans_common.c net: 9p: Fix kerneldoc warnings of missing parameters etc 2020-11-02 12:25:52 -08:00
trans_common.h 9p: fix a bunch of checkpatch warnings 2022-08-17 14:24:07 +02:00
trans_fd.c 9p/fd: Use P9_HDRSZ for header size 2022-12-14 11:37:16 +01:00
trans_rdma.c 9p/rdma: unmap receive dma buffer in rdma_request()/post_recv() 2023-03-11 13:57:29 +01:00
trans_virtio.c 9p: Add client parameter to p9_req_put() 2022-08-17 14:24:07 +02:00
trans_xen.c 9p/xen : Fix use after free bug in xen_9pfs_front_remove due to race condition 2023-04-20 12:13:53 +02:00