lkml.org 
[lkml]   [2013]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 01/11] random: don't feed stack data into pool when interrupt regs NULL
Date
From: Andi Kleen <ak@linux.intel.com>

In some cases, e.g. after this

arch/ia64/kernel/irq.c:185: struct pt_regs *old_regs = set_irq_regs(NULL);
arch/ia64/kernel/irq_ia64.c:560: struct pt_regs *old_regs = set_irq_regs(NULL);

the regs passed to add_interrupt_randomness() could be NULL.

In this case fast_mix would use two uninitialized ints from the stack
and mix it into the pool.

In this case set the input to 0.

Cc: tony.luck@intel.com
Cc: tytso@mit.edu
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
drivers/char/random.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 7737b5b..25ed2dc 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -752,6 +752,8 @@ void add_interrupt_randomness(int irq, int irq_flags)
__u64 ip = instruction_pointer(regs);
input[2] = ip;
input[3] = ip >> 32;
+ } else {
+ input[2] = input[3] = 0;
}

fast_mix(fast_pool, input, sizeof(input));
--
1.8.3.1


\
 
 \ /
  Last update: 2013-09-30 23:01    [W:0.231 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site