Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758340AbZDWHld (ORCPT ); Thu, 23 Apr 2009 03:41:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754817AbZDWHaT (ORCPT ); Thu, 23 Apr 2009 03:30:19 -0400 Received: from sous-sol.org ([216.99.217.87]:50388 "EHLO x200.localdomain" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756394AbZDWHaS (ORCPT ); Thu, 23 Apr 2009 03:30:18 -0400 Message-Id: <20090423072542.417763086@sous-sol.org> User-Agent: quilt/0.47-1 Date: Thu, 23 Apr 2009 00:21:06 -0700 From: Chris Wright To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , Willy Tarreau , Rodrigo Rubira Branco , Jake Edge , Eugene Teo , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Herbert Xu , Yehuda Sadeh Subject: [patch 046/100] crypto: shash - Fix unaligned calculation with short length References: <20090423072020.428683652@sous-sol.org> Content-Disposition: inline; filename=crypto-shash-fix-unaligned-calculation-with-short-length.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1217 Lines: 35 -stable review patch. If anyone has any objections, please let us know. --------------------- From: Yehuda Sadeh upstream commit: f4f689933c63e0fbfba62f2a80efb2b424b139ae When the total length is shorter than the calculated number of unaligned bytes, the call to shash->update breaks. For example, calling crc32c on unaligned buffer with length of 1 can result in a system crash. Signed-off-by: Yehuda Sadeh Signed-off-by: Herbert Xu Signed-off-by: Chris Wright --- crypto/shash.c | 3 +++ 1 file changed, 3 insertions(+) --- a/crypto/shash.c +++ b/crypto/shash.c @@ -82,6 +82,9 @@ static int shash_update_unaligned(struct u8 buf[shash_align_buffer_size(unaligned_len, alignmask)] __attribute__ ((aligned)); + if (unaligned_len > len) + unaligned_len = len; + memcpy(buf, data, unaligned_len); return shash->update(desc, buf, unaligned_len) ?: -- 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/