[PATCH 4.2 197/258] USB: chaoskey read offset bug

From: Greg Kroah-Hartman
Date: Sat Oct 17 2015 - 22:45:12 EST


4.2-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alexander Inyukhin <shurick@xxxxxxxxxxxxxx>

commit 1d5c47f555c5ae050fad22e4a99f88856cae5d05 upstream.

Rng reads in chaoskey driver could return the same data under
the certain conditions.

Signed-off-by: Alexander Inyukhin <shurick@xxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/usb/misc/chaoskey.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/misc/chaoskey.c
+++ b/drivers/usb/misc/chaoskey.c
@@ -472,7 +472,7 @@ static int chaoskey_rng_read(struct hwrn
if (this_time > max)
this_time = max;

- memcpy(data, dev->buf, this_time);
+ memcpy(data, dev->buf + dev->used, this_time);

dev->used += this_time;



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/