Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] Fix manual binding infinite loop

Fix for manual binding of drivers to devices. Problem is if you pass in
a valid device id, but the driver refuses to bind. Infinite loop as
write() tries to resubmit the data it just sent.

Thanks to Michal Ostrowski <mostrows@watson.ibm.com> for pointing the
problem out.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

+3 -1
+3 -1
drivers/base/bus.c
··· 156 156 device_release_driver(dev); 157 157 err = count; 158 158 } 159 - return err; 159 + if (err) 160 + return err; 161 + return count; 160 162 } 161 163 static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); 162 164