Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH 1/1] media: subdev: Make get_fmt on INTERNAL pads without STREAMS an error
@ 2026-10-06  9:29 Sakari Ailus
  2026-10-07  9:43 ` Hans Verkuil
  0 siblings, 1 reply; 5+ messages in thread
From: Sakari Ailus @ 2026-10-06  9:29 UTC (permalink / raw)
  To: linux-media
  Cc: hans, laurent.pinchart, Prabhakar, Kate Hsuan, Dave Stevenson,
	Tommaso Merciai, Benjamin Mugnier, Sylvain Petinot,
	Christophe JAILLET, Julien Massot, Naushir Patuck, Yan, Dongcheng,
	Stefan Klug, Mirela Rabulea, André Apitzsch,
	Heimir Thor Sverrisson, Kieran Bingham, Mehdi Djait,
	Ricardo Ribalda Delgado, Hans de Goede, Jacopo Mondi,
	Tomi Valkeinen, David Plowman, Yu, Ong Hock, Ng, Khai Wen,
	Jai Luthra, Rishikesh Donadkar, Mattijs Korpershoek, Antti Laakso

Internal pads should only be accessible to file handles with
V4L2_SUBDEV_CLIENT_CAP_STREAMS flag set. Return an error otherwise.

Fixes: 49cdf56876d3 ("media: mc: Add INTERNAL pad flag")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index a07d77e584c3..7cb5a40f0f8c 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -854,8 +854,13 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 	case VIDIOC_SUBDEV_G_FMT: {
 		struct v4l2_subdev_format *format = arg;
 
-		if (!client_supports_streams)
+		if (!client_supports_streams) {
+			if (format->pad < sd->entity.num_pads &&
+			    sd->entity.pads[format->pad].flags & MEDIA_PAD_FL_INTERNAL)
+				return -EINVAL;
+
 			format->stream = 0;
+		}
 
 		memset(format->reserved, 0, sizeof(format->reserved));
 		memset(format->format.reserved, 0, sizeof(format->format.reserved));

-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-08 12:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-06  9:29 [PATCH 1/1] media: subdev: Make get_fmt on INTERNAL pads without STREAMS an error Sakari Ailus
2026-10-07  9:43 ` Hans Verkuil
2026-10-07  9:48   ` Sakari Ailus
2026-10-07 10:14     ` Hans Verkuil
2026-10-08 12:26       ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox