From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A87C5C2BB9A for ; Mon, 14 Dec 2020 20:04:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4B4B62076B for ; Mon, 14 Dec 2020 20:04:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B4B62076B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qjfEhybOInkuMycTd6XiRrm9TglvHPFpHF+q+0BKDWo=; b=acbdqYOab67qtMPtzEBwQ0OwU4 n0qwFZOoS716UgKcmacGGMdGnCHMSOmPfkQQizWIEpDeAXeuB0RJSOplByLuVae+RTFSTtDBSBEc7 OcQeaU0KW+gXGO3dmVeG5KQn3m/Y6R7P+u6iLpg0xhfhKV2DzIEvd0S9cNbmJJP3ZNxFGbB+akLaw DugVvlkegwpGZDyfh8iavtmBOynUN8M1Z0946ByWO3Q/YBa1V/ae9TlMA22bl13GKUCWnB00sbpLG GUStIuAzqJWlDqa+d+VFYTVy4wlLI38QHWGTpd9wniHEkz1IDqE/XxTJCZIFt4UT5D1i9EEmUJb5C /2RQk56A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kou3m-0007OO-L6; Mon, 14 Dec 2020 20:03:06 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kou3k-0007Nr-UA for linux-arm-kernel@lists.infradead.org; Mon, 14 Dec 2020 20:03:05 +0000 Received: by mail-pf1-x442.google.com with SMTP id c79so12825501pfc.2 for ; Mon, 14 Dec 2020 12:03:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BdxMVC3y5nlR7LDMxIQSz3qWj9jrWm9Nsf2wISBO6pc=; b=LFVHg2rNbEt02LLPnkWOohGk8VIhywesyIxgHiqAVoru6cI75unOmiStz32cZ6y+5B GL+mJ6YH7mTcGxudEG3o5arOqjNvAQrUwRWzSPqM3W3iJv9O34xi9vG3w41FH5zMUvN1 3ADDsOv8n7jI+sQAcZBmLufNtQsEwc1/LoOT/1hVCz/kru0CHAKgtKnTGlmeHskONmo+ CEAoXXJ3X+2jP2fcKovBAXjO4XiHWndTM5VjpJcyjYGp+eqkdDH2c+691UZpMUAAERWu 8ScMA0Hp3TEsajRGKrtzklh2DM7t/Vu5rGcrKy+t2aRigykj3BF+P0iSSeHgZ4TQ6FQ/ 93bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BdxMVC3y5nlR7LDMxIQSz3qWj9jrWm9Nsf2wISBO6pc=; b=tCP51/7Od2NwR3WQMWo+P+2SzCJ+xl158js30g+aE2rCBDRyGTDbH1xQL1qNwhWORQ dxU8xg3AFS1Pw7ySrww/EeNrmZ6IFoM7hsOEJ0v57LrG7tkD0ST5iuYlJXvgm17/GyU9 R9+FkipYcTL41SDq8BQR3aEqs7P0SMiQrbrky/LnZP/bSSZ1rZUGJ9zOehc8k9ArR+I1 GbIq16VxmM7gbXpF4XSWE5eyaCosPByPYCIr1emMrdD5VYq+VX46zqISc7oHchIgOhK7 mScee0KaN0pM+x2syNFEKpgtXTllk7vBgP6JLYWhorSDSndOLneesBdqwP7Lx7V0eE9Q SrUg== X-Gm-Message-State: AOAM532f1qCIavi0sEakcqlA16lj9L1q/nvRy1yle4yBB4BMnzg8p2G+ gR1EkwF5ACkYi0nBQMsxBnAwyA== X-Google-Smtp-Source: ABdhPJzKh8HJaK54TRvEM5Wt0CA7yuq8pZy4BPn2IMdwD95gbsiCsgLgHhwTk/FqSplATiFqAetjqw== X-Received: by 2002:a63:c04b:: with SMTP id z11mr25034328pgi.74.1607976182932; Mon, 14 Dec 2020 12:03:02 -0800 (PST) Received: from localhost.localdomain ([163.172.76.58]) by smtp.googlemail.com with ESMTPSA id js9sm22434109pjb.2.2020.12.14.12.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 12:03:02 -0800 (PST) From: Corentin Labbe To: arnd@arndb.de, davem@davemloft.net, herbert@gondor.apana.org.au, jernej.skrabec@siol.net, mripard@kernel.org, wens@csie.org Subject: [PATCH v4 2/8] crypto: sun4i-ss: checking sg length is not sufficient Date: Mon, 14 Dec 2020 20:02:26 +0000 Message-Id: <20201214200232.17357-3-clabbe@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201214200232.17357-1-clabbe@baylibre.com> References: <20201214200232.17357-1-clabbe@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201214_150304_989357_62961E33 X-CRM114-Status: GOOD ( 16.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe , linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The optimized cipher function need length multiple of 4 bytes. But it get sometimes odd length. This is due to SG data could be stored with an offset. So the fix is to check also if the offset is aligned with 4 bytes. Fixes: 6298e948215f2 ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator") Cc: Signed-off-by: Corentin Labbe --- drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c index 19f1aa577ed4..f49797588329 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c @@ -186,12 +186,12 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) * we can use the SS optimized function */ while (in_sg && no_chunk == 1) { - if (in_sg->length % 4) + if ((in_sg->length | in_sg->offset) & 3u) no_chunk = 0; in_sg = sg_next(in_sg); } while (out_sg && no_chunk == 1) { - if (out_sg->length % 4) + if ((out_sg->length | out_sg->offset) & 3u) no_chunk = 0; out_sg = sg_next(out_sg); } -- 2.26.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel