Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3204150pxb; Sun, 20 Feb 2022 12:27:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXbFBZlMFam8ssKFSBOqJ6USuc6gux8jwLiADHfMB7W3GJuYHOpqCTH1mYOyX94/70Yb0j X-Received: by 2002:a17:907:271b:b0:6b8:7863:bf3e with SMTP id w27-20020a170907271b00b006b87863bf3emr14266819ejk.188.1645388830018; Sun, 20 Feb 2022 12:27:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645388830; cv=none; d=google.com; s=arc-20160816; b=mCKQ3Tqzs/cVnJQDHvRPC+lvCLiRaNDWo95R7KdznDhxolNNRpflp58iAJoycJLr/K UJYewdx8zpPaElnf+w1M9QS8ruEwW5tHobBnpWH45+3qTFrCx+y0WuIFUCcB3oXfYCp3 GcHjAhdKc89SRFNskrPPTkg29mB9PzUB7qsKbFo2BnfM8Qth0jxOSRc7IV4vg2mT0lwo qe5rJFwQchJtyCPRE4udvcVhhb2Az0yCu2u7Leqi+OGAUQNWl++T7MMJNqRs/lFZz4bx t85TJ/SuAOoN9TFCaJIuPiIWcoSAUoEys5Dc62hB1KqvkS6yPK/e/azXWO3ug86oD7dJ ECBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VkufqB68vwU82OqW1wmmBDTcSYneYNTpwXuWchj68oY=; b=B/2QZShqbVJT/0IJdaCOeveV6rETEsulchaRgbEVZe9Pc4yqdKKltCgF+5r6sGRx9W jUwjlDJEXho3dBfUOC2lqp2smy58/wsZhhk63sZHqCmwe8/s9cb3ZhhzKdJ7nD7C1Imj tuhQ9WWMaanVK6I/TrlacHemhK6FS/1aRPwY2qGiq1dKD2E7hND7OVyBvoz3K6GFzMhj 3OJJLL1tbkKwAd0/grRJU7nDcvh/FNNc3/CusOIdLY5u7qfVKw2o4Ji14CwVGtvWYJKp sc/ON0zLfEJrl+BFQkizX3AA9SAT/lXnq+2uI2SOp0Z664ZZ3234kgdfLp/qF7AnaglT VFDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BQAEOqjg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go32si9206346ejc.784.2022.02.20.12.26.46; Sun, 20 Feb 2022 12:27:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BQAEOqjg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244620AbiBTTZE (ORCPT + 99 others); Sun, 20 Feb 2022 14:25:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236189AbiBTTZC (ORCPT ); Sun, 20 Feb 2022 14:25:02 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74B313C715; Sun, 20 Feb 2022 11:24:40 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id m27so11711447wrb.4; Sun, 20 Feb 2022 11:24:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=VkufqB68vwU82OqW1wmmBDTcSYneYNTpwXuWchj68oY=; b=BQAEOqjgCS43797jo9OoAHnbWjCc0lci0e2p//X296F4B7h+l2Fur4fw6HKrQMhQ2a K2YjtUWCID637pDp1UT7DASqfoYKWvlOaO1K9fUPC2KAh+8/Kq9lfd3PjNTTgnKqJpTq xSH6ERovv99mUBjjSMP/SzY47PuFBWt9S0AuyEAmVKs3xb8m9i0BqrXmO3v4kMAbMP6A eoBZc+hu2QSNTsXStYqiolrENJRrP3l167agG/qXcPMjEUPsVBIDi0uKYi0YZR3G9BY2 soNbjCZv8ppFZEAvLYm6HT3iTcvYcRUqPf2sy1k7QBQqq8W0rfL7HahrFsuvKmYrbFdk CBQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=VkufqB68vwU82OqW1wmmBDTcSYneYNTpwXuWchj68oY=; b=h0DngN7oRkCGTNnv7Acdi5aFLmGasRHm+AksXAc46M6/s2Y9Di19dCxx6t5b04WJGm orDGuk0DUqak1iaJloadGw/XD82nBFOOSe9Ug6/+0c5cBcKmXHLwkV7xCLkVy7TFlV4A LURHE9lJlwF0PyN1GKrcwoENrjN5ZuGKMMHidbO1x0kCJW5OlLYuyD0wBdQWEjCJ4rYf AF0tjWgpWFsK/QdfdXiJxDKqveUtUoYbGbYcNLqQ6j5iu82hern/ZNLYUi8pOWqc3CAL 108IqOGuGH5AMMaFi0t9EWOWDfrrhF1JuN3EEz1+pkqGQUYQJfR+EojNo5YK40dX7XhA qv9w== X-Gm-Message-State: AOAM530Ijszv+ecEf7cYoPNzWqkOzR2HJg6Ja4TBv9VQ1B/VvecV1d+G kzmGGA8g3N8jGXdM49nVyxaYPfshet4= X-Received: by 2002:adf:fe0f:0:b0:1e2:f9dc:6ed with SMTP id n15-20020adffe0f000000b001e2f9dc06edmr13605627wrr.530.1645385078997; Sun, 20 Feb 2022 11:24:38 -0800 (PST) Received: from Red ([2a01:cb1d:3d5:a100:264b:feff:fe03:2806]) by smtp.googlemail.com with ESMTPSA id f25sm5345021wml.16.2022.02.20.11.24.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Feb 2022 11:24:38 -0800 (PST) Date: Sun, 20 Feb 2022 20:24:36 +0100 From: Corentin Labbe To: Gilad Ben-Yossef Cc: Herbert Xu , "David S. Miller" , Ofir Drang , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] crypto: ccree: don't attempt 0 len DMA mappings Message-ID: References: <20220217192726.612328-1-gilad@benyossef.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220217192726.612328-1-gilad@benyossef.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le Thu, Feb 17, 2022 at 09:27:26PM +0200, Gilad Ben-Yossef a ?crit : > Refuse to try mapping zero bytes as this may cause a fault > on some configurations / platforms and it seems the prev. > attempt is not enough and we need to be more explicit. > > Signed-off-by: Gilad Ben-Yossef > Reported-by: Corentin Labbe > Fixes: ce0fc6db38de ("crypto: ccree - protect against empty or NULL > scatterlists") > --- > drivers/crypto/ccree/cc_buffer_mgr.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/crypto/ccree/cc_buffer_mgr.c b/drivers/crypto/ccree/cc_buffer_mgr.c > index a5e041d9d2cf..11e0278c8631 100644 > --- a/drivers/crypto/ccree/cc_buffer_mgr.c > +++ b/drivers/crypto/ccree/cc_buffer_mgr.c > @@ -258,6 +258,13 @@ static int cc_map_sg(struct device *dev, struct scatterlist *sg, > { > int ret = 0; > > + if (!nbytes) { > + *mapped_nents = 0; > + *lbytes = 0; > + *nents = 0; > + return 0; > + } > + > *nents = cc_get_sgl_nents(dev, sg, nbytes, lbytes); > if (*nents > max_sg_nents) { > *nents = 0; > -- > 2.25.1 > Hello With this patch, the stacktrace I reported is not present anymore. Tested-by: Corentin Labbe Tested-on: r8a7795-salvator-x Regards