driver core: suppress sending MODALIAS in UNBIND uevents
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 13 Sep 2017 23:29:48 +0000 (16:29 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Sep 2017 14:48:33 +0000 (16:48 +0200)
commit6878e7de6af726de47f9f3bec649c3f49e786586
tree50f2bc55120a88d9891866526c5a56ebb2ac1898
parent2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e
driver core: suppress sending MODALIAS in UNBIND uevents

The current udev rules cause modules to be loaded on all device events save
for "remove". With the introduction of KOBJ_BIND/KOBJ_UNBIND this causes
issues, as driver modules that have devices bound to their drivers get
immediately reloaded, and it appears to the user that module unloading doe
snot work.

The standard udev matching rule is foillowing:

ENV{MODALIAS}=="?*", RUN{builtin}+="kmod load $env{MODALIAS}"

Given that MODALIAS data is not terribly useful for UNBIND event, let's zap
it from the generated uevent environment until we get userspace updated
with the correct udev rule that only loads modules on "add" event.

Reported-by: Jakub Kicinski <kubakici@wp.pl>
Tested-by: Jakub Kicinski <kubakici@wp.pl>
Fixes: 1455cf8dbfd0 ("driver core: emit uevents when device is bound ...")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/kobject_uevent.c