Skip to content

Commit

Permalink
media: v4l2-core: fix a use-after-free bug of sd->devnode
Browse files Browse the repository at this point in the history
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: 0e43734 ("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>
  • Loading branch information
Dafna Hirschfeld authored and Mauro Carvalho Chehab committed Mar 5, 2020
1 parent 4032651 commit 6990570
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/media/v4l2-core/v4l2-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 6990570

Please sign in to comment.