From: Hans Verkuil <hverkuil@xs4all.nl>
To: Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Janusz Krzysztofik" <jmkrzyszt@gmail.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>
Subject: [PATCH for v5.3] v4l2-subdev: fix regression in check_pad()
Date: Sat, 29 Jun 2019 14:59:42 +0200 [thread overview]
Message-ID: <f20fffad-c2e4-1aed-1644-4ed2c8395173@xs4all.nl> (raw)
sd->entity.graph_obj.mdev can be NULL when this function is called, and
that breaks existing drivers (rcar-vin, but probably others as well).
Check if sd->entity.num_pads is non-zero instead since that doesn't depend
on mdev.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Fixes: a8fa55078a77 ("media: v4l2-subdev: Verify arguments in v4l2_subdev_call()")
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
Changes in v2:
- Don't change the coding style, just fix the bug.
---
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 21fb90d66bfc..25c73c13cc7e 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -124,7 +124,7 @@ static inline int check_which(__u32 which)
static inline int check_pad(struct v4l2_subdev *sd, __u32 pad)
{
#if defined(CONFIG_MEDIA_CONTROLLER)
- if (sd->entity.graph_obj.mdev) {
+ if (sd->entity.num_pads) {
if (pad >= sd->entity.num_pads)
return -EINVAL;
return 0;
next reply other threads:[~2019-06-29 12:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-29 12:59 Hans Verkuil [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-06-29 10:00 [PATCH for v5.3] v4l2-subdev: fix regression in check_pad() Hans Verkuil
2019-06-29 11:33 ` Niklas Söderlund
2019-06-29 12:06 ` Janusz Krzysztofik
2019-06-29 12:57 ` Hans Verkuil
2019-06-29 13:08 ` Hans Verkuil
2019-07-01 7:50 ` Sakari Ailus
2019-07-01 21:24 ` Janusz Krzysztofik
2019-06-29 13:13 ` Janusz Krzysztofik
2019-06-29 13:19 ` Hans Verkuil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f20fffad-c2e4-1aed-1644-4ed2c8395173@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=jmkrzyszt@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).