[PATCH] Fix manual binding infinite loop

From: Greg KH
Date: Wed Aug 17 2005 - 19:34:03 EST


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@xxxxxxxxxxxxxx> for pointing the
problem out.

Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/base/bus.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)

--- gregkh-2.6.orig/drivers/base/bus.c 2005-08-02 13:41:26.000000000 -0700
+++ gregkh-2.6/drivers/base/bus.c 2005-08-17 17:11:35.000000000 -0700
@@ -180,7 +180,9 @@ static ssize_t driver_bind(struct device
up(&dev->sem);
put_device(dev);
}
- return err;
+ if (err)
+ return err;
+ return count;
}
static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/