From f42441ac992e8e4451b60e50534ca8b6c2814cd2 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Wed, 16 Nov 2011 15:59:46 -0500 Subject: [PATCH] Fix thinko in get_random_bytes(). --- get_random_bytes-consecutive-words.patch | 40 ++++++++++++++++++++++++ kernel.spec | 7 +++++ 2 files changed, 47 insertions(+) create mode 100644 get_random_bytes-consecutive-words.patch diff --git a/get_random_bytes-consecutive-words.patch b/get_random_bytes-consecutive-words.patch new file mode 100644 index 000000000..9c70424ba --- /dev/null +++ b/get_random_bytes-consecutive-words.patch @@ -0,0 +1,40 @@ +From: "Luck, Tony" +To: Linus Torvalds , + "H. Peter Anvin" , Ingo Molnar , + Thomas Gleixner , + Fenghua Yu , Matt Mackall , + Herbert Xu , + "Theodore Ts'o" , Jeff Garzik , + Arjan van de Ven , linux-kernel@vger.kernel.org +Subject: [PATCH] fix typo/thinko in get_random_bytes() +Date: Wed, 16 Nov 2011 10:50:56 -0800 +Message-Id: <4ec4061010261a4cb0@agluck-desktop.sc.intel.com> + +If there is an architecture-specific random number generator we use +it to acquire randomness one "long" at a time. We should put these +random words into consecutive words in the result buffer - not just +overwrite the first word again and again. + +Signed-off-by: Tony Luck + +--- + +diff --git a/drivers/char/random.c b/drivers/char/random.c +index 63e19ba..6035ab8 100644 +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -941,7 +941,7 @@ void get_random_bytes(void *buf, int nbytes) + if (!arch_get_random_long(&v)) + break; + +- memcpy(buf, &v, chunk); ++ memcpy(p, &v, chunk); + p += chunk; + nbytes -= chunk; + } +-- +To unsubscribe from this list: send the line "unsubscribe linux-kernel" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html +Please read the FAQ at http://www.tux.org/lkml/ + diff --git a/kernel.spec b/kernel.spec index 28e8eb9c3..9794219ce 100644 --- a/kernel.spec +++ b/kernel.spec @@ -635,6 +635,8 @@ Patch3500: jbd-jbd2-validate-sb-s_first-in-journal_get_superblo.patch #rhbz 753236 Patch4000: nfsv4-include-bitmap-in-nfsv4_get_acl_data.patch +Patch10000: get_random_bytes-consecutive-words.patch + # patches headed upstream Patch12010: add-appleir-usb-driver.patch @@ -1219,6 +1221,8 @@ ApplyPatch disable-i8042-check-on-apple-mac.patch ApplyPatch add-appleir-usb-driver.patch +ApplyPatch get_random_bytes-consecutive-words.patch + ApplyPatch udlfb-bind-framebuffer-to-interface.patch ApplyPatch epoll-limit-paths.patch ApplyPatch rcu-avoid-just-onlined-cpu-resched.patch @@ -1885,6 +1889,9 @@ fi # and build. %changelog +* Wed Nov 16 2011 Dave Jones +- Fix thinko in get_random_bytes(). + * Wed Nov 16 2011 Kyle McMartin - Work around #663080 on s390x and restore building perf there.