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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <57c1d52a5a8f5985dc1dd53260d7d68795be8ea2.1519321145.git.jsarha@ti.com>
Date:   Thu, 22 Feb 2018 19:42:46 +0200
From:   Jyri Sarha <jsarha@...com>
To:     <linux-kernel@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>
CC:     <tomi.valkeinen@...com>, <thierry.reding@...il.com>,
        <lukas@...ner.de>, <gregkh@...uxfoundation.org>,
        Jyri Sarha <jsarha@...com>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>
Subject: [PATCH RFC] driver core: Reprobe consumer if it was unbound by dropped device_link

Put consumer device to deferred probe list if it is unbound due to a
dropped link to a supplier.

When a device link supplier is unbound (either manually or because one
of its own suppliers was unbound), its consumers are unbound as
well. Currently if the supplier binds again after this the consumer
does not automatically probe again. With this patch it does.

If this patch is not acceptable as such, how about adding this
behavior behind a new device link flag?

The idea to this patch was gotten from this post by Lucas Wunner:
https://www.spinics.net/lists/dri-devel/msg166318.html

Part of the code and the description is borrowed from him.

cc: Lukas Wunner <lukas@...ner.de>
cc: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
cc: Thierry Reding <thierry.reding@...il.com>
Signed-off-by: Jyri Sarha <jsarha@...com>
---
 drivers/base/base.h | 1 +
 drivers/base/core.c | 2 ++
 drivers/base/dd.c   | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/base/base.h b/drivers/base/base.h
index d800de6..39370eb 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -114,6 +114,7 @@ extern void device_release_driver_internal(struct device *dev,
 
 extern void driver_detach(struct device_driver *drv);
 extern int driver_probe_device(struct device_driver *drv, struct device *dev);
+extern void driver_deferred_probe_add(struct device *dev);
 extern void driver_deferred_probe_del(struct device *dev);
 static inline int driver_match_device(struct device_driver *drv,
 				      struct device *dev)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index b2261f9..0964ed5 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -570,6 +570,8 @@ void device_links_unbind_consumers(struct device *dev)
 
 			device_release_driver_internal(consumer, NULL,
 						       consumer->parent);
+			driver_deferred_probe_add(consumer);
+
 			put_device(consumer);
 			goto start;
 		}
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index de6fd09..846ae78 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -140,7 +140,7 @@ static void deferred_probe_work_func(struct work_struct *work)
 }
 static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func);
 
-static void driver_deferred_probe_add(struct device *dev)
+void driver_deferred_probe_add(struct device *dev)
 {
 	mutex_lock(&deferred_probe_mutex);
 	if (list_empty(&dev->p->deferred_probe)) {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ