From patchwork Fri Feb 7 05:25:27 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: 3599801 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 19E7FBF418 for ; Fri, 7 Feb 2014 05:26:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C6BA2016C for ; Fri, 7 Feb 2014 05:26:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8955F20154 for ; Fri, 7 Feb 2014 05:26:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751907AbaBGFZq (ORCPT ); Fri, 7 Feb 2014 00:25:46 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:24373 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbaBGFZp (ORCPT ); Fri, 7 Feb 2014 00:25:45 -0500 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N0M003ES1QW3A10@mailout4.samsung.com>; Fri, 07 Feb 2014 14:25:44 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 53.27.09028.85E64F25; Fri, 07 Feb 2014 14:25:44 +0900 (KST) X-AuditID: cbfee68e-b7f566d000002344-b1-52f46e58eff0 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id AB.AB.29263.75E64F25; Fri, 07 Feb 2014 14:25:44 +0900 (KST) Received: from chnaveen-ubuntu.sisodomain.com ([107.108.83.161]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N0M002E01QRBM80@mmp2.samsung.com>; Fri, 07 Feb 2014 14:25:43 +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 Subject: [PATCH 7/9 v6] crypto:s5p-sss: validate iv before memcpy Date: Fri, 07 Feb 2014 10:55:27 +0530 Message-id: <1391750727-27496-1-git-send-email-ch.naveen@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1389243640-13282-1-git-send-email-ch.naveen@samsung.com> References: <1389243640-13282-1-git-send-email-ch.naveen@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsWyRsSkTjci70uQwawGfouXhzQtul/JWNy/ 95PJ4vKuOWwWM87vY7JYtO0/s8XZOYeYHNg9ds66y+6x7YCqR9+WVYwenzfJBbBEcdmkpOZk lqUW6dslcGW8f9vMXHCErWL7xL2sDYxbWbsYOTkkBEwkLm1bzAxhi0lcuLeerYuRi0NIYCmj xMd7N9hhip6/n8UCkZjOKLF96Seoqn4miQ8fX4NVsQmYSRxctBrMFhFwlvjdvAZsBbNAM6PE j9lgtrCAo8T5exvBalgEVCX2Pz4PZvMKuEocfNIHVMMBtE1BYs4kG5Awp4CbxNbLT8BKhIBK 5py4ygyyV0Kgm11i1+nHLBBzBCS+TT7EAtErK7HpANQ3khIHV9xgmcAovICRYRWjaGpBckFx UnqRkV5xYm5xaV66XnJ+7iZGYFif/vesbwfjzQPWhxiTgcZNZJYSTc4HxkVeSbyhsZmRhamJ qbGRuaUZacJK4ryLHiY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K074osRSnJFoqMVcVJwIAJLXldLeAgAA 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.4 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 --- changes since v5: 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 da1c8943..a890273 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);