public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] firewire: core: feed /dev/random with devices' GUIDs
       [not found] <5027CFA7.9000100@ladisch.de>
@ 2012-08-12 21:58 ` Stefan Richter
  2012-08-13  7:08   ` Clemens Ladisch
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Richter @ 2012-08-12 21:58 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: linux1394-devel, linux-kernel, Theodore Ts'o

On Aug 12 Clemens Ladisch wrote:
> Send the GUIDs of newly registered controllers and devices
> to the /dev/random driver to help seed its pools.
> 
> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>

This looks good to me, almost.  Isn't the call in fw_card_add redundant?
The local node's fw_device instance initializer feeds the same GUID,
although a little bit later.

(Added CC: lkml and Theodore because I am not overly familiar with this
matter.)

> ---
>  drivers/firewire/core-card.c   |    3 +++
>  drivers/firewire/core-device.c |    3 +++
>  2 files changed, 6 insertions(+), 0 deletions(-)
> 
> based on 3.6-rc1
> 
> --- a/drivers/firewire/core-card.c
> +++ b/drivers/firewire/core-card.c
> @@ -29,6 +29,7 @@
>  #include <linux/list.h>
>  #include <linux/module.h>
>  #include <linux/mutex.h>
> +#include <linux/random.h>
>  #include <linux/spinlock.h>
>  #include <linux/workqueue.h>
> 
> @@ -570,6 +571,8 @@ int fw_card_add(struct fw_card *card,
>  	card->link_speed = link_speed;
>  	card->guid = guid;
> 
> +	add_device_randomness(&guid, sizeof(guid));
> +
>  	mutex_lock(&card_mutex);
> 
>  	generate_config_rom(card, tmp_config_rom);
> --- a/drivers/firewire/core-device.c
> +++ b/drivers/firewire/core-device.c
> @@ -32,6 +32,7 @@
>  #include <linux/mod_devicetable.h>
>  #include <linux/module.h>
>  #include <linux/mutex.h>
> +#include <linux/random.h>
>  #include <linux/rwsem.h>
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
> @@ -1066,6 +1067,8 @@ static void fw_device_init(struct work_struct *work)
>  		device->config_rom_retries = 0;
> 
>  		set_broadcast_channel(device, device->generation);
> +
> +		add_device_randomness(&device->config_rom[3], 8);
>  	}
> 
>  	/*



-- 
Stefan Richter
-=====-===-- =--- -==--
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] firewire: core: feed /dev/random with devices' GUIDs
  2012-08-12 21:58 ` [PATCH] firewire: core: feed /dev/random with devices' GUIDs Stefan Richter
@ 2012-08-13  7:08   ` Clemens Ladisch
  0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2012-08-13  7:08 UTC (permalink / raw)
  To: Stefan Richter; +Cc: linux1394-devel, linux-kernel, Theodore Ts'o

Stefan Richter wrote:
> On Aug 12 Clemens Ladisch wrote:
>> Send the GUIDs of newly registered controllers and devices
>> to the /dev/random driver to help seed its pools.
>
> This looks good to me, almost.  Isn't the call in fw_card_add redundant?
> The local node's fw_device instance initializer feeds the same GUID,
> although a little bit later.

Oops, indeed.  Just drop that hunk:

--8<---------------------------------------------------------------->8--
firewire: core: feed /dev/random with devices' GUIDs

Send the GUIDs of newly registered controllers and devices
to the /dev/random driver to help seed its pools.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
---
 drivers/firewire/core-device.c |    3 +++
 1 file changed, 3 insertions(+), 0 deletions(-)

--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -32,6 +32,7 @@
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
+#include <linux/random.h>
 #include <linux/rwsem.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -1066,6 +1067,8 @@ static void fw_device_init(struct work_struct *work)
 		device->config_rom_retries = 0;

 		set_broadcast_channel(device, device->generation);
+
+		add_device_randomness(&device->config_rom[3], 8);
 	}

 	/*

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-13  7:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5027CFA7.9000100@ladisch.de>
2012-08-12 21:58 ` [PATCH] firewire: core: feed /dev/random with devices' GUIDs Stefan Richter
2012-08-13  7:08   ` Clemens Ladisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox