[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <00000000000044f99c06093a30cc@google.com>
Date: Fri, 03 Nov 2023 00:09:42 -0700
From: syzbot <syzbot+d31adfb277377ef8fcba@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org
Subject: Re: [syzbot] test uaf in iommufd_vfio_ioas
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org.
***
Subject: test uaf in iommufd_vfio_ioas
Author: lizhi.xu@...driver.com
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2af9b20dbb39
diff --git a/drivers/iommu/iommufd/main.c b/drivers/iommu/iommufd/main.c
index e71523cbd0de..6b75f9fab6ce 100644
--- a/drivers/iommu/iommufd/main.c
+++ b/drivers/iommu/iommufd/main.c
@@ -208,11 +208,14 @@ static int iommufd_destroy(struct iommufd_ucmd *ucmd)
{
struct iommu_destroy *cmd = ucmd->cmd;
struct iommufd_object *obj;
+ struct iommufd_ioas *ioas;
obj = iommufd_object_remove(ucmd->ictx, cmd->id, false);
if (IS_ERR(obj))
return PTR_ERR(obj);
iommufd_object_ops[obj->type].destroy(obj);
+ ioas = container_of(obj, struct iommufd_ioas, obj);
+ ioas->obj = NULL;
kfree(obj);
return 0;
}
diff --git a/drivers/iommu/iommufd/vfio_compat.c b/drivers/iommu/iommufd/vfio_compat.c
index 6c810bf80f99..06317d0bd95e 100644
--- a/drivers/iommu/iommufd/vfio_compat.c
+++ b/drivers/iommu/iommufd/vfio_compat.c
@@ -140,6 +140,8 @@ int iommufd_vfio_ioas(struct iommufd_ucmd *ucmd)
ioas = iommufd_get_ioas(ucmd->ictx, cmd->ioas_id);
if (IS_ERR(ioas))
return PTR_ERR(ioas);
+ if (!ioas->obj)
+ return -EINVAL;
xa_lock(&ucmd->ictx->objects);
ucmd->ictx->vfio_ioas = ioas;
xa_unlock(&ucmd->ictx->objects);
Powered by blists - more mailing lists