Skip to content

Commit

Permalink
media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release
Browse files Browse the repository at this point in the history
[ Upstream commit 7dd0c9e ]

A use after free bug caused by the dangling pointer
filp->privitate_data in v4l2_fh_release.
See https://lore.kernel.org/patchwork/patch/1419058/.

My patch sets the dangling pointer to NULL to provide
robust.

Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yunlongs authored and gregkh committed Jul 14, 2021
1 parent 5d00265 commit f9f334f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/media/v4l2-core/v4l2-fh.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ int v4l2_fh_release(struct file *filp)
v4l2_fh_del(fh);
v4l2_fh_exit(fh);
kfree(fh);
filp->private_data = NULL;
}
return 0;
}
Expand Down

0 comments on commit f9f334f

Please sign in to comment.