diff options
author | Zhangfei Gao <zhangfei.gao@linaro.org> | 2023-05-11 17:59:20 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-05-31 19:00:26 +0100 |
commit | df1b056d489d98c7c45fa89627102dd34b44496f (patch) | |
tree | bf3562a5bff1da63e8e5c9b3479c47cc0bef37b3 /include | |
parent | 24ee010bdabb15c601ab6ce2007ad32f4ef4a880 (diff) | |
download | linux-df1b056d489d98c7c45fa89627102dd34b44496f.tar.gz linux-df1b056d489d98c7c45fa89627102dd34b44496f.tar.bz2 linux-df1b056d489d98c7c45fa89627102dd34b44496f.zip |
uacce: use q->mapping to replace inode->i_mapping
The inode can be different in a container, for example, a docker and host
both open the same uacce parent device, which uses the same uacce struct
but different inode, so uacce->inode is not enough.
What's worse, when docker stops, the inode will be destroyed as well,
causing use-after-free in uacce_remove.
So use q->mapping to replace uacce->inode->i_mapping.
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Link: https://lore.kernel.org/r/20230511095921.9331-2-zhangfei.gao@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/uacce.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/uacce.h b/include/linux/uacce.h index 0a81c3dfd26c..e290c0269944 100644 --- a/include/linux/uacce.h +++ b/include/linux/uacce.h @@ -86,6 +86,7 @@ enum uacce_q_state { * @state: queue state machine * @pasid: pasid associated to the mm * @handle: iommu_sva handle returned by iommu_sva_bind_device() + * @mapping: user space mapping of the queue */ struct uacce_queue { struct uacce_device *uacce; @@ -97,6 +98,7 @@ struct uacce_queue { enum uacce_q_state state; u32 pasid; struct iommu_sva *handle; + struct address_space *mapping; }; /** @@ -114,7 +116,6 @@ struct uacce_queue { * @mutex: protects uacce operation * @priv: private pointer of the uacce * @queues: list of queues - * @inode: core vfs */ struct uacce_device { const char *algs; @@ -130,7 +131,6 @@ struct uacce_device { struct mutex mutex; void *priv; struct list_head queues; - struct inode *inode; }; #if IS_ENABLED(CONFIG_UACCE) |