[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DS0PR11MB7529F25EF35901D55F8FB4A9C3AA9@DS0PR11MB7529.namprd11.prod.outlook.com>
Date: Wed, 22 Feb 2023 09:25:20 +0000
From: "Liu, Yi L" <yi.l.liu@...el.com>
To: "Zhao, Yan Y" <yan.y.zhao@...el.com>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"jgg@...dia.com" <jgg@...dia.com>,
"Tian, Kevin" <kevin.tian@...el.com>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] vfio: Fix NULL pointer dereference caused by
uninitialized group->iommufd
> From: Zhao, Yan Y <yan.y.zhao@...el.com>
> Sent: Wednesday, February 22, 2023 3:50 PM
> group->iommufd is not initialized for the iommufd_ctx_put()
>
> [20018.331541] BUG: kernel NULL pointer dereference, address:
> 0000000000000000
> [20018.377508] RIP: 0010:iommufd_ctx_put+0x5/0x10 [iommufd]
> ...
> [20018.476483] Call Trace:
> [20018.479214] <TASK>
> [20018.481555] vfio_group_fops_unl_ioctl+0x506/0x690 [vfio]
> [20018.487586] __x64_sys_ioctl+0x6a/0xb0
> [20018.491773] ? trace_hardirqs_on+0xc5/0xe0
> [20018.496347] do_syscall_64+0x67/0x90
> [20018.500340] entry_SYSCALL_64_after_hwframe+0x4b/0xb5
>
> Fixes: 9eefba8002c2 ("vfio: Move vfio group specific code into group.c")
> Signed-off-by: Yan Zhao <yan.y.zhao@...el.com>
Reviewed-by: Yi Liu <yi.l.liu@...el.com>
> ---
> drivers/vfio/group.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
> index 57ebe5e1a7e6..8649f85f3be4 100644
> --- a/drivers/vfio/group.c
> +++ b/drivers/vfio/group.c
> @@ -137,7 +137,7 @@ static int vfio_group_ioctl_set_container(struct
> vfio_group *group,
>
> ret = iommufd_vfio_compat_ioas_id(iommufd, &ioas_id);
> if (ret) {
> - iommufd_ctx_put(group->iommufd);
> + iommufd_ctx_put(iommufd);
> goto out_unlock;
> }
>
> --
> 2.17.1
Powered by blists - more mailing lists