diff options
author | Theodore Ts'o <tytso@mit.edu> | 2012-07-04 11:22:20 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-07-14 20:17:45 -0400 |
commit | b04b3156a20d395a7faa8eed98698d1e17a36000 (patch) | |
tree | 8d4d79420e21f73ea014bc0a7c5d757db6b77319 /drivers/usb | |
parent | a2080a67abe9e314f9e9c2cc3a4a176e8a8f8793 (diff) |
usb: feed USB device information to the /dev/random driver
Send the USB device's serial, product, and manufacturer strings to the
/dev/random driver to help seed its pools.
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Greg KH <greg@kroah.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hub.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 25a7422ee657..7f380ff1f786 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/kthread.h> | 24 | #include <linux/kthread.h> |
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/freezer.h> | 26 | #include <linux/freezer.h> |
27 | #include <linux/random.h> | ||
27 | 28 | ||
28 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
29 | #include <asm/byteorder.h> | 30 | #include <asm/byteorder.h> |
@@ -2173,6 +2174,14 @@ int usb_new_device(struct usb_device *udev) | |||
2173 | /* Tell the world! */ | 2174 | /* Tell the world! */ |
2174 | announce_device(udev); | 2175 | announce_device(udev); |
2175 | 2176 | ||
2177 | if (udev->serial) | ||
2178 | add_device_randomness(udev->serial, strlen(udev->serial)); | ||
2179 | if (udev->product) | ||
2180 | add_device_randomness(udev->product, strlen(udev->product)); | ||
2181 | if (udev->manufacturer) | ||
2182 | add_device_randomness(udev->manufacturer, | ||
2183 | strlen(udev->manufacturer)); | ||
2184 | |||
2176 | device_enable_async_suspend(&udev->dev); | 2185 | device_enable_async_suspend(&udev->dev); |
2177 | 2186 | ||
2178 | /* | 2187 | /* |