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 20, 2021
1 parent cd16b8a commit c7c1d06
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 @@ -104,6 +104,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 c7c1d06

Please sign in to comment.