Commit 282c22a8 authored by Zhangfei Gao's avatar Zhangfei Gao Committed by Greg Kroah-Hartman

uacce: vma_close clears q->qfrs when freeing qfrs

vma_close frees qfrs but not clears q->qfrs, which still points
to the freed object, leading to subsequent mmap fail.
So vma_close clears q->qfrs as well.
Suggested-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarZhangfei Gao <zhangfei.gao@linaro.org>
Link: https://lore.kernel.org/r/20230511095921.9331-3-zhangfei.gao@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent df1b056d
......@@ -200,12 +200,15 @@ static int uacce_fops_release(struct inode *inode, struct file *filep)
static void uacce_vma_close(struct vm_area_struct *vma)
{
struct uacce_queue *q = vma->vm_private_data;
struct uacce_qfile_region *qfr = NULL;
if (vma->vm_pgoff < UACCE_MAX_REGION)
qfr = q->qfrs[vma->vm_pgoff];
if (vma->vm_pgoff < UACCE_MAX_REGION) {
struct uacce_qfile_region *qfr = q->qfrs[vma->vm_pgoff];
kfree(qfr);
mutex_lock(&q->mutex);
q->qfrs[vma->vm_pgoff] = NULL;
mutex_unlock(&q->mutex);
kfree(qfr);
}
}
static const struct vm_operations_struct uacce_vm_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment