uacce: use q->mapping to replace inode->i_mapping
authorZhangfei Gao <zhangfei.gao@linaro.org>
Thu, 11 May 2023 09:59:20 +0000 (17:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 May 2023 18:00:26 +0000 (19:00 +0100)
commitdf1b056d489d98c7c45fa89627102dd34b44496f
treebf3562a5bff1da63e8e5c9b3479c47cc0bef37b3
parent24ee010bdabb15c601ab6ce2007ad32f4ef4a880
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>
drivers/misc/uacce/uacce.c
include/linux/uacce.h