From patchwork Mon Feb 17 09:44:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Krishna Chatradhi X-Patchwork-Id: 3661751 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EAC649F38B for ; Mon, 17 Feb 2014 09:48:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 084F520155 for ; Mon, 17 Feb 2014 09:48:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 301F32013A for ; Mon, 17 Feb 2014 09:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750982AbaBQJsI (ORCPT ); Mon, 17 Feb 2014 04:48:08 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:14618 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752735AbaBQJpS (ORCPT ); Mon, 17 Feb 2014 04:45:18 -0500 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N14007ZRWFHM330@mailout2.samsung.com>; Mon, 17 Feb 2014 18:45:17 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 8C.89.12635.D2AD1035; Mon, 17 Feb 2014 18:45:17 +0900 (KST) X-AuditID: cbfee68d-b7fcd6d00000315b-a5-5301da2d5b84 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 41.D2.29263.D2AD1035; Mon, 17 Feb 2014 18:45:17 +0900 (KST) Received: from chnaveen-ubuntu.sisodomain.com ([107.108.83.161]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N1400BHIWF16070@mmp1.samsung.com>; Mon, 17 Feb 2014 18:45:17 +0900 (KST) From: Naveen Krishna Chatradhi To: linux-crypto@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, vzapolskiy@gmail.com, herbert@gondor.apana.org.au, naveenkrishna.ch@gmail.com, cpgs@samsung.com, davem@davemloft.net Subject: [PATCH 7/9 v7] crypto:s5p-sss: validate iv before memcpy Date: Mon, 17 Feb 2014 15:14:33 +0530 Message-id: <1392630275-8667-8-git-send-email-ch.naveen@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1392630275-8667-1-git-send-email-ch.naveen@samsung.com> References: <1392630275-8667-1-git-send-email-ch.naveen@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOLMWRmVeSWpSXmKPExsWyRsSkVlf3FmOwwcx+CYuXhzQt5pxvYbHo fiVjcf/eTyaLy7vmsFnMOL+PyWLRtv/MFmfnHGJy4PDYsvImk8fOWXfZPbYdUPXo27KK0ePz JrkA1igum5TUnMyy1CJ9uwSujFdXT7MXTOOo2DHzNlsD42e2LkYODgkBE4lZb4S7GDmBTDGJ C/fWA4W5OIQEljJKPH85jwkiYSJx5tgsZojEIkaJrsl3oar6mST+rd/DBlLFJmAmcXDRanYQ W0TAWeJ38xpWkCJmgVmMErPvf2IEWScs4Cjx80gWSA2LgKrEzTcPmEFsXgEXickb3zJDXKQg MWeSDUiYU8BVovPOdhYQWwioZF3nJRaQkRICi9gl/t9uYoKYIyDxbfIhFoheWYlNB5ghjpaU OLjiBssERuEFjAyrGEVTC5ILipPSiwz1ihNzi0vz0vWS83M3MQID/fS/Z707GG8fsD7EmAw0 biKzlGhyPj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XIqXS/8odv9s3OQbnPvhnvX v5bJq5rylq64vJ19l6v63a4Uq/D+3M9KuTt8lhfv5cz93vLKPTdmthJLcUaioRZzUXEiABiT 0KvoAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds code to validate "iv" buffer before trying to memcpy the contents Signed-off-by: Naveen Krishna Chatradhi Reviewed-by: Tomasz Figa CC: David S. Miller CC: Herbert Xu CC: Vladimir Zapolskiy TO: CC: --- Changes since v6: None drivers/crypto/s5p-sss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c index fa21db5..7da1da4 100644 --- a/drivers/crypto/s5p-sss.c +++ b/drivers/crypto/s5p-sss.c @@ -380,7 +380,8 @@ static void s5p_set_aes(struct s5p_aes_dev *dev, { void __iomem *keystart; - memcpy(dev->aes_ioaddr + SSS_REG_AES_IV_DATA(0), iv, 0x10); + if (iv) + memcpy(dev->aes_ioaddr + SSS_REG_AES_IV_DATA(0), iv, 0x10); if (keylen == AES_KEYSIZE_256) keystart = dev->aes_ioaddr + SSS_REG_AES_KEY_DATA(0);