Files
omarchy-pkgs/pkgbuilds/linux-omarchy/0801-amd-pmf-util-unbind-use-after-free.patch
T

35 lines
1.0 KiB
Diff

diff --git a/drivers/platform/x86/amd/pmf/util.c b/drivers/platform/x86/amd/pmf/util.c
index 1111111..2222222 100644
--- a/drivers/platform/x86/amd/pmf/util.c
+++ b/drivers/platform/x86/amd/pmf/util.c
@@ -79,9 +79,9 @@ static int amd_pmf_populate_data(struct amd_pmf_dev *pdev, struct amd_pmf_info *
static long amd_pmf_set_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
- struct amd_pmf_dev *pdev = filp->private_data;
void __user *argp = (void __user *)arg;
struct amd_pmf_info info = {};
+ struct amd_pmf_dev *pdev;
size_t copy_size;
__u64 user_size;
int ret;
@@ -94,6 +94,10 @@ static long amd_pmf_set_ioctl(struct file *filp, unsigned int cmd, unsigned long
return -EFAULT;
guard(mutex)(&pmf_util_lock);
+ pdev = pmf_dev_handle;
+ if (!pdev)
+ return -ENODEV;
+
ret = amd_pmf_populate_data(pdev, &info);
if (ret)
return ret;
@@ -115,7 +119,6 @@ static int amd_pmf_open(struct inode *inode, struct file *filp)
if (!pmf_dev_handle)
return -ENODEV;
- filp->private_data = pmf_dev_handle;
return 0;
}