Displaying 20 results from an estimated 36 matches for "old_rng".
2014 Sep 18
0
[PATCH 4/5] hw_random: don't double-check old_rng.
...le changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index b4a21e9521cf..6a34feca6b43 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -472,14 +472,13 @@ int hwrng_register(struct hwrng *rng)
}
old_rng = current_rng;
+ err = 0;
if (!old_rng) {
err = hwrng_init(rng);
if (err)
goto out_unlock;
set_current_rng(rng);
- }
- err = 0;
- if (!old_rng) {
+
err = register_miscdev();
if (err) {
drop_current_rng();
--
1.9.1
2014 Jul 14
0
[RFC PATCH 1/3] hw_random: allow RNG devices to give early randomness after a delay
...g);
+
+ schedule_delayed_work(&rng->dwork, msecs_to_jiffies(500));
+}
+
static inline int hwrng_init(struct hwrng *rng)
{
if (rng->init) {
@@ -351,6 +366,7 @@ int hwrng_register(struct hwrng *rng)
goto out_unlock;
}
+ INIT_DELAYED_WORK(&rng->dwork, sched_init_random);
old_rng = current_rng;
if (!old_rng) {
err = hwrng_init(rng);
@@ -362,6 +378,7 @@ int hwrng_register(struct hwrng *rng)
if (!old_rng) {
err = register_miscdev();
if (err) {
+ cancel_delayed_work_sync(&rng->dwork);
hwrng_cleanup(rng);
current_rng = NULL;
goto out_unlock;
@@...
2014 Dec 06
7
[PATCH v5 0/6] fix hw_random stuck
...mos Kong (1):
hw_random: move some code out mutex_lock for avoiding underlying
deadlock
Rusty Russell (5):
hw_random: place mutex around read functions and buffers.
hw_random: use reference counts on each struct hwrng.
hw_random: fix unregister race.
hw_random: don't double-check old_rng.
hw_random: don't init list element we're about to add to list.
drivers/char/hw_random/core.c | 173 ++++++++++++++++++++++++++++++------------
include/linux/hw_random.h | 3 +
2 files changed, 126 insertions(+), 50 deletions(-)
--
1.9.3
2014 Dec 06
7
[PATCH v5 0/6] fix hw_random stuck
...mos Kong (1):
hw_random: move some code out mutex_lock for avoiding underlying
deadlock
Rusty Russell (5):
hw_random: place mutex around read functions and buffers.
hw_random: use reference counts on each struct hwrng.
hw_random: fix unregister race.
hw_random: don't double-check old_rng.
hw_random: don't init list element we're about to add to list.
drivers/char/hw_random/core.c | 173 ++++++++++++++++++++++++++++++------------
include/linux/hw_random.h | 3 +
2 files changed, 126 insertions(+), 50 deletions(-)
--
1.9.3
2014 Dec 08
8
[PATCH v5 REPOST 0/6] fix hw_random stuck
...mos Kong (1):
hw_random: move some code out mutex_lock for avoiding underlying
deadlock
Rusty Russell (5):
hw_random: place mutex around read functions and buffers.
hw_random: use reference counts on each struct hwrng.
hw_random: fix unregister race.
hw_random: don't double-check old_rng.
hw_random: don't init list element we're about to add to list.
drivers/char/hw_random/core.c | 173 ++++++++++++++++++++++++++++++------------
include/linux/hw_random.h | 3 +
2 files changed, 126 insertions(+), 50 deletions(-)
--
1.9.3
2014 Dec 08
8
[PATCH v5 REPOST 0/6] fix hw_random stuck
...mos Kong (1):
hw_random: move some code out mutex_lock for avoiding underlying
deadlock
Rusty Russell (5):
hw_random: place mutex around read functions and buffers.
hw_random: use reference counts on each struct hwrng.
hw_random: fix unregister race.
hw_random: don't double-check old_rng.
hw_random: don't init list element we're about to add to list.
drivers/char/hw_random/core.c | 173 ++++++++++++++++++++++++++++++------------
include/linux/hw_random.h | 3 +
2 files changed, 126 insertions(+), 50 deletions(-)
--
1.9.3
2014 Nov 03
9
[PATCH v4 0/6] fix hw_random stuck
...mos Kong (1):
hw_random: move some code out mutex_lock for avoiding underlying
deadlock
Rusty Russell (5):
hw_random: place mutex around read functions and buffers.
hw_random: use reference counts on each struct hwrng.
hw_random: fix unregister race.
hw_random: don't double-check old_rng.
hw_random: don't init list element we're about to add to list.
drivers/char/hw_random/core.c | 176 ++++++++++++++++++++++++++++++------------
include/linux/hw_random.h | 3 +
2 files changed, 129 insertions(+), 50 deletions(-)
--
1.9.3
2014 Nov 03
9
[PATCH v4 0/6] fix hw_random stuck
...mos Kong (1):
hw_random: move some code out mutex_lock for avoiding underlying
deadlock
Rusty Russell (5):
hw_random: place mutex around read functions and buffers.
hw_random: use reference counts on each struct hwrng.
hw_random: fix unregister race.
hw_random: don't double-check old_rng.
hw_random: don't init list element we're about to add to list.
drivers/char/hw_random/core.c | 176 ++++++++++++++++++++++++++++++------------
include/linux/hw_random.h | 3 +
2 files changed, 129 insertions(+), 50 deletions(-)
--
1.9.3
2014 Sep 18
9
[PATCH v2 0/6] fix hw_random stuck
...mos Kong (1):
hw_random: move some code out mutex_lock for avoiding underlying
deadlock
Rusty Russell (5):
hw_random: place mutex around read functions and buffers.
hw_random: use reference counts on each struct hwrng.
hw_random: fix unregister race.
hw_random: don't double-check old_rng.
hw_random: don't init list element we're about to add to list.
drivers/char/hw_random/core.c | 166 +++++++++++++++++++++++++++++-------------
include/linux/hw_random.h | 2 +
2 files changed, 117 insertions(+), 51 deletions(-)
--
1.9.3
2014 Sep 18
9
[PATCH v2 0/6] fix hw_random stuck
...mos Kong (1):
hw_random: move some code out mutex_lock for avoiding underlying
deadlock
Rusty Russell (5):
hw_random: place mutex around read functions and buffers.
hw_random: use reference counts on each struct hwrng.
hw_random: fix unregister race.
hw_random: don't double-check old_rng.
hw_random: don't init list element we're about to add to list.
drivers/char/hw_random/core.c | 166 +++++++++++++++++++++++++++++-------------
include/linux/hw_random.h | 2 +
2 files changed, 117 insertions(+), 51 deletions(-)
--
1.9.3
2014 Jul 10
0
[PATCH v3 1/2] hwrng: fetch randomness only after device init
...rng);
+ if (rng->init) {
+ int ret;
+
+ ret = rng->init(rng);
+ if (ret)
+ return ret;
+ }
+ add_early_randomness(rng);
+ return 0;
}
static inline void hwrng_cleanup(struct hwrng *rng)
@@ -304,8 +323,6 @@ int hwrng_register(struct hwrng *rng)
{
int err = -EINVAL;
struct hwrng *old_rng, *tmp;
- unsigned char bytes[16];
- int bytes_read;
if (rng->name == NULL ||
(rng->data_read == NULL && rng->read == NULL))
@@ -347,9 +364,17 @@ int hwrng_register(struct hwrng *rng)
INIT_LIST_HEAD(&rng->list);
list_add_tail(&rng->list, &rng_list);...
2014 Sep 18
6
[PATCH v2 2/3] hw_random: fix stuck in catting hwrng attributes
Amos Kong <akong at redhat.com> writes:
> I started a QEMU (non-smp) guest with one virtio-rng device, and read
> random data from /dev/hwrng by dd:
>
> # dd if=/dev/hwrng of=/dev/null &
>
> In the same time, if I check hwrng attributes from sysfs by cat:
>
> # cat /sys/class/misc/hw_random/rng_*
>
> The cat process always gets stuck with slow backend (5
2014 Sep 18
6
[PATCH v2 2/3] hw_random: fix stuck in catting hwrng attributes
Amos Kong <akong at redhat.com> writes:
> I started a QEMU (non-smp) guest with one virtio-rng device, and read
> random data from /dev/hwrng by dd:
>
> # dd if=/dev/hwrng of=/dev/null &
>
> In the same time, if I check hwrng attributes from sysfs by cat:
>
> # cat /sys/class/misc/hw_random/rng_*
>
> The cat process always gets stuck with slow backend (5
2014 Jul 14
4
[RFC PATCH 0/3] hw_random: support for delayed init randomness requests
Hello,
This series introduces a way to allow devices to contribute to initial
system randomness after a certain delay. Specifically, the virtio-rng
device can contribute initial randomness only after a successful
probe().
A delayed workqueue item is queued in the system queue to fetch this
randomness if the device indicates it's capable of contributing only
after a delay, via the new
2014 Jul 14
4
[RFC PATCH 0/3] hw_random: support for delayed init randomness requests
Hello,
This series introduces a way to allow devices to contribute to initial
system randomness after a certain delay. Specifically, the virtio-rng
device can contribute initial randomness only after a successful
probe().
A delayed workqueue item is queued in the system queue to fetch this
randomness if the device indicates it's capable of contributing only
after a delay, via the new
2014 Jul 10
5
[PATCH v3 0/2] hwrng, virtio-rng: init-time fixes
v3:
- Kees Cook pointed out a weird side-effect: devices which have
->init() registered get their randomness added to the system each
time they're switched in, but devices that don't have the init
callback don't contribute to system randomness more than once. The
weirdness is resolved here by using the randomness each time
hwrng_init() is attempted, irrespective of
2014 Jul 10
5
[PATCH v3 0/2] hwrng, virtio-rng: init-time fixes
v3:
- Kees Cook pointed out a weird side-effect: devices which have
->init() registered get their randomness added to the system each
time they're switched in, but devices that don't have the init
callback don't contribute to system randomness more than once. The
weirdness is resolved here by using the randomness each time
hwrng_init() is attempted, irrespective of
2014 Jul 05
0
[PATCH v2 1/2] hwrng: fetch randomness only after device init
...)
return 0;
- return rng->init(rng);
+
+ ret = rng->init(rng);
+ if (ret)
+ return ret;
+
+ add_early_randomness(rng);
+ return ret;
}
static inline void hwrng_cleanup(struct hwrng *rng)
@@ -304,8 +325,6 @@ int hwrng_register(struct hwrng *rng)
{
int err = -EINVAL;
struct hwrng *old_rng, *tmp;
- unsigned char bytes[16];
- int bytes_read;
if (rng->name == NULL ||
(rng->data_read == NULL && rng->read == NULL))
@@ -347,9 +366,9 @@ int hwrng_register(struct hwrng *rng)
INIT_LIST_HEAD(&rng->list);
list_add_tail(&rng->list, &rng_list);...
2014 Sep 18
0
[PATCH 5/5] hw_random: don't init list element we're about to add to list.
...e.c
index 6a34feca6b43..96fa06716e95 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -485,7 +485,6 @@ int hwrng_register(struct hwrng *rng)
goto out_unlock;
}
}
- INIT_LIST_HEAD(&rng->list);
list_add_tail(&rng->list, &rng_list);
if (old_rng && !rng->init) {
--
1.9.1
2014 Jul 07
1
[PATCH v2 1/2] hwrng: fetch randomness only after device init
On (Mon) 07 Jul 2014 [11:23:52], Amit Shah wrote:
> On (Sun) 06 Jul 2014 [21:41:47], Kees Cook wrote:
> > On Fri, Jul 4, 2014 at 10:34 PM, Amit Shah <amit.shah at redhat.com> wrote:
> > > Commit d9e7972619334 "hwrng: add randomness to system from rng sources"
> > > added a call to rng_get_data() from the hwrng_register() function.
> > > However,