Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757501AbYCNJb1 (ORCPT ); Fri, 14 Mar 2008 05:31:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757091AbYCNJay (ORCPT ); Fri, 14 Mar 2008 05:30:54 -0400 Received: from mtagate3.de.ibm.com ([195.212.29.152]:30346 "EHLO mtagate3.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757033AbYCNJav (ORCPT ); Fri, 14 Mar 2008 05:30:51 -0400 Message-Id: <20080314093046.656233449@de.ibm.com> References: <20080314092523.147382820@de.ibm.com> User-Agent: quilt/0.46-1 Date: Fri, 14 Mar 2008 10:25:24 +0100 From: Martin Schwidefsky To: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Cc: Ralph Wuerthner , Martin Schwidefsky Subject: [patch 1/2] hw_random: allow rng_dev_read() to return hardware errors. Content-Disposition: inline; filename=111-crypto-hwerrors.diff Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1466 Lines: 46 From: Ralph Wuerthner The api for hardware random number generators is currently limited to devices that never fail. If the hardware is registered as a source for random numbers it has to work. This prevents the use of i/o based random number devices where the i/o might fail. Add a check for errors after the read from a hardware random number device. This patch is required to support large random numbers retrieved from the CEX2C cards on System z. Signed-off-by: Ralph Wuerthner Signed-off-by: Martin Schwidefsky --- drivers/char/hw_random/core.c | 4 ++++ 1 file changed, 4 insertions(+) Index: quilt-2.6/drivers/char/hw_random/core.c =================================================================== --- quilt-2.6.orig/drivers/char/hw_random/core.c +++ quilt-2.6/drivers/char/hw_random/core.c @@ -116,6 +116,10 @@ static ssize_t rng_dev_read(struct file err = -EAGAIN; if (!bytes_read && (filp->f_flags & O_NONBLOCK)) goto out; + if (bytes_read < 0) { + err = bytes_read; + goto out; + } err = -EFAULT; while (bytes_read && size) { -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- 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/