lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250709222708.1509409-1-e.shatokhin@yadro.com>
Date: Thu, 10 Jul 2025 01:27:08 +0300
From: Evgenii Shatokhin <e.shatokhin@...ro.com>
To: Sakari Ailus <sakari.ailus@...ux.intel.com>
CC: Mauro Carvalho Chehab <mchehab@...nel.org>, <linux-media@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <linux@...ro.com>, Evgenii Shatokhin
	<e.shatokhin@...ro.com>
Subject: [PATCH] media: v4l: async: Set correct owner for sensor subdevices

Commit 8a718752f5c3 ("media: v4l: async: Set owner for async sub-devices")
turned v4l2_async_register_subdev() into a macro that used THIS_MODULE to
obtain the owner module for the subdevice.

v4l2_async_register_subdev_sensor(sd) calls v4l2_async_register_subdev(),
and that will reset sd->owner to NULL for the sensor device, if V4L2 core
is built-in while the sensor driver is built as a module.

sd->owner is reset this way even if the sensor driver has set it properly
earlier.

This patch makes v4l2_async_register_subdev_sensor() a macro similar to
v4l2_async_register_subdev() to pass the owner module to the latter.

Fixes: 8a718752f5c3 ("media: v4l: async: Set owner for async sub-devices")
Signed-off-by: Evgenii Shatokhin <e.shatokhin@...ro.com>
---
 drivers/media/v4l2-core/v4l2-fwnode.c | 7 ++++---
 include/media/v4l2-async.h            | 4 +++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
index cb153ce42c45..c86daef2fd3f 100644
--- a/drivers/media/v4l2-core/v4l2-fwnode.c
+++ b/drivers/media/v4l2-core/v4l2-fwnode.c
@@ -1246,7 +1246,8 @@ v4l2_async_nf_parse_fwnode_sensor(struct device *dev,
 	return 0;
 }
 
-int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)
+int __v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd,
+					struct module *module)
 {
 	struct v4l2_async_notifier *notifier;
 	int ret;
@@ -1272,7 +1273,7 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)
 	if (ret < 0)
 		goto out_cleanup;
 
-	ret = v4l2_async_register_subdev(sd);
+	ret = __v4l2_async_register_subdev(sd, module);
 	if (ret < 0)
 		goto out_unregister;
 
@@ -1290,7 +1291,7 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(v4l2_async_register_subdev_sensor);
+EXPORT_SYMBOL_GPL(__v4l2_async_register_subdev_sensor);
 
 MODULE_DESCRIPTION("V4L2 fwnode binding parsing library");
 MODULE_LICENSE("GPL");
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index f26c323e9c96..54a2d9620ed5 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -333,8 +333,10 @@ int __v4l2_async_register_subdev(struct v4l2_subdev *sd, struct module *module);
  * An error is returned if the module is no longer loaded on any attempts
  * to register it.
  */
+#define v4l2_async_register_subdev_sensor(sd) \
+	__v4l2_async_register_subdev_sensor(sd, THIS_MODULE)
 int __must_check
-v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd);
+__v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd, struct module *module);
 
 /**
  * v4l2_async_unregister_subdev - unregisters a sub-device to the asynchronous
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ