diff options
author | Dafna Hirschfeld <dafna.hirschfeld@collabora.com> | 2020-02-19 16:25:54 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-03-05 22:44:06 +0100 |
commit | 6990570f7e0a6078e11b9c5dc13f4b6e3f49a398 (patch) | |
tree | 89f942b4b09d868553716eac88ab7fa7735745bb /drivers/media/v4l2-core | |
parent | media: vimc: use-after-free fix - release vimc in the v4l_device release (diff) | |
download | linux-6990570f7e0a6078e11b9c5dc13f4b6e3f49a398.tar.xz linux-6990570f7e0a6078e11b9c5dc13f4b6e3f49a398.zip |
media: v4l2-core: fix a use-after-free bug of sd->devnode
sd->devnode is released after calling
v4l2_subdev_release. Therefore it should be set
to NULL so that the subdev won't hold a pointer
to a released object. This fixes a reference
after free bug in function
v4l2_device_unregister_subdev
Fixes: 0e43734d4c46e ("media: v4l2-subdev: add release() internal op")
Cc: stable@vger.kernel.org
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-device.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c index 63d6b147b21e..41da73ce2e98 100644 --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -179,6 +179,7 @@ static void v4l2_subdev_release(struct v4l2_subdev *sd) if (sd->internal_ops && sd->internal_ops->release) sd->internal_ops->release(sd); + sd->devnode = NULL; module_put(owner); } |