Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp12884rdh; Wed, 25 Oct 2023 14:31:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBhMQ2RQQ/FxEEs1zLGEDY2SkHTs8BlH71h4s9bqlykrRvFoTFXB9Sl2fBdfOw+CmNBsS+ X-Received: by 2002:a05:6808:182a:b0:3b2:e95d:8b2 with SMTP id bh42-20020a056808182a00b003b2e95d08b2mr21700793oib.12.1698269497907; Wed, 25 Oct 2023 14:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698269497; cv=none; d=google.com; s=arc-20160816; b=KBIaA6l3p6fPl5OIMgh7TOfVq0nCHchmh5GBQ8lkVVJBKKtkjVhlvNim6r8HHrKu/Z bCAJQIFYKZ5TXbP8elR6uqywJ6/nkn7Ae93CIVMJ0NP2T09p/NG2upXx7XuAW64GAv7A UhUnPldCtnoIQsA4zOmaq/1rIJv+BVeO3tzNKXXGqZqcggzlrc3981Aitcbv4U8BkLFT 6y4cr+W5peoswClCddti1h78/Aal3xfgqWoEdVsXpy/2W+y7wg2by1SZ8KTbUdMBviy6 H0T6BJ0tepuy8BHhen1pGn9HaaOdZHqDSxTGN8QG2wNHGPZPCXALisTbFzJ+2Ai8XnId jRnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=daM238Gk86FAx1eqmdjO8f6vcKFZYd8Y5/mnjK6105g=; fh=xqt8Ie6oO+KDmGw3MrRk3B1GD2sLZqGnPXyfPERkHVs=; b=guhdDm5sOf4K7MWxn8CWXZJMbwU5YaLssr7LI/i7yxW4+XJ57WyzIfB1dDCpZWdLHd SVfb2QE9n5YDpAabKfLpLFdDkcnaSVIDWzdEj6rsUePqqorMhyICmPL/ZUhiOG3V2n8v eBSGggNpTAcoWKrfjyuYXRGTPwuadSqeqJPbyzOgwvLbx8sEej5oiyUc7FKAGXpPg8+b r162NAnoJ+ePwBYURmv9d86UeEnlYrrm+cGtqXu0V6n1RM6yH/GKJ2wigR2BjA3eN43G 6tkjRXe8KVk66q65sZg3GdZ6nWgCQ27qA8YtKs0AqM+h1feL1ir0hCcGIBKLyUjfDPX6 keww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V03LB5AG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id j76-20020a25d24f000000b00d9acbe274fbsi11425672ybg.538.2023.10.25.14.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 14:31:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V03LB5AG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id F259A8093D51; Wed, 25 Oct 2023 14:31:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbjJYVa6 (ORCPT + 99 others); Wed, 25 Oct 2023 17:30:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbjJYVaz (ORCPT ); Wed, 25 Oct 2023 17:30:55 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C314133 for ; Wed, 25 Oct 2023 14:30:53 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF330C433C7; Wed, 25 Oct 2023 21:30:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698269453; bh=866yJ6QEGke94UXkLijvdFJbDhsr/QcS04165KyCsiE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=V03LB5AGmTa2S0gwTGLR0QsbNNE4fsKEyw5CvM/d1G0lUP33AwaYenDUmklzr06hf uxgOr9Z7MlDyakRq/IX8/UMl5/P8kWUaBgHiUmcJeuPAzJx9mHISNIknW2a+jR255X QrJwkF34lLPGmMXyOkEufZY5iara7NWfC+9WzEQltCvtphdMYyy6Zot5SLmpEiVz8V If+lG5KnGVXoIqs9iKltg1WfD3+3QPpjri58IwFSlQRG5Xb5/T+hSbiU4C1bpFQSiD 48icvZKTp2nVv4n15RGZ4/QNc39JFK5uO4FcGn9rVtRGOhpDZiUL14sivxNlrJXISW 8g4Ly4+WKKprw== Date: Wed, 25 Oct 2023 14:30:51 -0700 From: Jakub Kicinski To: Sabrina Dubroca Cc: Hangyu Hua , borisp@nvidia.com, john.fastabend@gmail.com, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: tls: Fix possible NULL-pointer dereference in tls_decrypt_device() and tls_decrypt_sw() Message-ID: <20231025143051.6cfe4fc5@kernel.org> In-Reply-To: References: <20231023080611.19244-1-hbh25y@gmail.com> <120e6c2c-6122-41db-8c46-7753e9659c70@gmail.com> <20231025071408.3b33f733@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 25 Oct 2023 14:31:06 -0700 (PDT) On Wed, 25 Oct 2023 23:20:23 +0200 Sabrina Dubroca wrote: > There's already a comment above tls_decrypt_sg that (pretty much) says > out_iov is only used in zero-copy mode. > > * [...] The input parameter 'darg->zc' indicates if > * zero-copy mode needs to be tried or not. With zero-copy mode, either > * out_iov or out_sg must be non-NULL. > > Do we need another just above the call to tls_decrypt_sg? Sounds good. Right next to a line of code that people will try to modify when whatever static checker they have tells them this is buggy :S Call site of tls_decrypt_sg() seems like a good bet.