From patchwork Tue Sep 29 10:57:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 263114 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=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 8C1CEC47423 for ; Tue, 29 Sep 2020 12:06:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 337262074B for ; Tue, 29 Sep 2020 12:06:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601381186; bh=1NFky1aHyOFCcv+zMkvnVftWgULXvQQIBmoB9HF5QTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Svo+lHZzLo0qKLUIu1kN7EZsWVkpUq5TKLGbZn9bv9v2caJp/se2nPfbt6CkcwXHM GbnmG/T4I/UbqXWYKOAD7bJrJeKhH95sLUo0GGAHAN3pU5Zb64gAGoig0SavfNW0+w pyuwYLceEijbEX6yXI70f5GE/nFTRSo2qx9Cbihs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731903AbgI2MGY (ORCPT ); Tue, 29 Sep 2020 08:06:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:58104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730265AbgI2Lhh (ORCPT ); Tue, 29 Sep 2020 07:37:37 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AD3F523B88; Tue, 29 Sep 2020 11:36:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379408; bh=1NFky1aHyOFCcv+zMkvnVftWgULXvQQIBmoB9HF5QTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iThlVAblSUfU/RmV1XJYDz6z74xBi/oB1UXM4caGFhlyU1aC5EAH6PnAYxHYeOU/Q o0HUHI/pF63h7Wi4cR4IHWjmWiSalV9tFrXkWqIisUEb2shMAPsHDik53HfF82rPm2 7hZLjl4UQ2uNGjdmlp309DJjKHzVn9pvOjRzvLas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ayush Sawal , Herbert Xu , Sasha Levin Subject: [PATCH 5.4 122/388] crypto: chelsio - This fixes the kernel panic which occurs during a libkcapi test Date: Tue, 29 Sep 2020 12:57:33 +0200 Message-Id: <20200929110016.374501547@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929110010.467764689@linuxfoundation.org> References: <20200929110010.467764689@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ayush Sawal [ Upstream commit 9195189e00a7db55e7d448cee973cae87c5a3c71 ] The libkcapi test which causes kernel panic is aead asynchronous vmsplice multiple test. ./bin/kcapi -v -d 4 -x 10 -c "ccm(aes)" -q 4edb58e8d5eb6bc711c43a6f3693daebde2e5524f1b55297abb29f003236e43d -t a7877c99 -n 674742abd0f5ba -k 2861fd0253705d7875c95ba8a53171b4 -a fb7bc304a3909e66e2e0c5ef952712dd884ce3e7324171369f2c5db1adc48c7d This patch avoids dma_mapping of a zero length sg which causes the panic, by using sg_nents_for_len which maps only upto a specific length Signed-off-by: Ayush Sawal Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/chelsio/chcr_algo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c index fe2eadc0ce83d..2d30ed5a2674b 100644 --- a/drivers/crypto/chelsio/chcr_algo.c +++ b/drivers/crypto/chelsio/chcr_algo.c @@ -2480,8 +2480,9 @@ int chcr_aead_dma_map(struct device *dev, else reqctx->b0_dma = 0; if (req->src == req->dst) { - error = dma_map_sg(dev, req->src, sg_nents(req->src), - DMA_BIDIRECTIONAL); + error = dma_map_sg(dev, req->src, + sg_nents_for_len(req->src, dst_size), + DMA_BIDIRECTIONAL); if (!error) goto err; } else {