mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
media: v4l: subdev: Make link validation safer
Link validation currently accesses invalid pointers if the link passed to
it is not between two sub-devices. This is of course a driver bug.
Ignore the error but print a warning message, as this is how it used to
work previously.
Fixes: a6b995ed03
("media: subdev: use streams in v4l2_subdev_link_validate()")
Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
530779157c
commit
55f1ecb119
1 changed files with 10 additions and 0 deletions
|
@ -1258,6 +1258,16 @@ int v4l2_subdev_link_validate(struct media_link *link)
|
|||
bool states_locked;
|
||||
int ret;
|
||||
|
||||
if (!is_media_entity_v4l2_subdev(link->sink->entity) ||
|
||||
!is_media_entity_v4l2_subdev(link->source->entity)) {
|
||||
pr_warn_once("%s of link '%s':%u->'%s':%u is not a V4L2 sub-device, driver bug!\n",
|
||||
!is_media_entity_v4l2_subdev(link->sink->entity) ?
|
||||
"sink" : "source",
|
||||
link->source->entity->name, link->source->index,
|
||||
link->sink->entity->name, link->sink->index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sink_sd = media_entity_to_v4l2_subdev(link->sink->entity);
|
||||
source_sd = media_entity_to_v4l2_subdev(link->source->entity);
|
||||
|
||||
|
|
Loading…
Reference in a new issue