media: v4l2-core: fix a use-after-free bug of sd->devnode
commit8e06cfc5af747644fe0af2034034180208377c74
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>
Wed, 19 Feb 2020 15:25:54 +0000 (19 16:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 08:58:19 +0000 (1 10:58 +0200)
tree89644b303f3312f66f57f507259e90e9319f9634
parentc62dc65b5e8d0e5be21158ec2678ef4f2f0c739c
media: v4l2-core: fix a use-after-free bug of sd->devnode

commit 6990570f7e0a6078e11b9c5dc13f4b6e3f49a398 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/v4l2-core/v4l2-device.c