Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp7835rdh; Wed, 25 Oct 2023 14:21:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3L7F1a4SOdW58Iidm2/1C8QYmMa0j9cKVT4NwwcWtexA8QPbEO56izNeFvxhWuNgEc4lN X-Received: by 2002:a0d:e84d:0:b0:5a7:d938:c5e2 with SMTP id r74-20020a0de84d000000b005a7d938c5e2mr17064347ywe.14.1698268864446; Wed, 25 Oct 2023 14:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698268864; cv=none; d=google.com; s=arc-20160816; b=x0e99Tb2z74P8ZaaxLePhfP4a+zbFgtdMiTs4a2rJ3zG9zfW1caEJs3chlCIXhsG65 8SUUV9yg4N2en+zEnrIwg9ODlHY9HEwPK/0m1wBqCiXXzibPYLqr/rKyN0AlmL35LXE7 5GMMSYUbR6dfv3wcV5ZXVnVfTe+p4FS+RuKgI7bWPJ/2aRZIxyl4v7BngFOZEiUmLYwT S4OTAiZ374+WSfYo8QU5jpt/w5Xn1S0COXs9vCAdExp8XQ64eE3joUP7JeL1YLPPbInU ZoP/FJNHhOi4D17g6YXCPKhZDhXNRxuIMCKrucWPL3wBpe/oqcn8ql2VH/atihWrRWCQ KjrA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=37lh2uyulrGufzSRwY6b00UZ2UZDkHpOXOxl9yMoVhc=; fh=by0roARJbg3Jh7oER/ZsHJhBccOeJxG5bPonIszH6+o=; b=BAOBaZ5RKnPhSgf2rAqwkuQpf8vGhMWCG/1/IEw36KPsiJp3WASqpWqbDLDW+utk/P m703JMzG9nAeVpgUJqnezAs3RSViXb1BCeNzrZnDvsvgrGEkRvq9116SuoEtVb5JVH2g mA7eqYHxk6sbvnv6kl0n58h+07D5gOUako6ALciuU9Gw2i5uqi5W4TahEVd4gGj1cIM3 /FZJqBme9+hdktraYfI0YG+QdVACiMQHBDJ8IZ+4Dd5Jj9wyOFqGhnz47tWaTBqflnQ1 uOzoChv5p11TeIXcZolXLZD59dDMXNZsWr6MBS7XGdBhw1HZkZdcMuT3XnvFRC5pmbxg coLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id r80-20020a0de853000000b0056ce2ff50fcsi11768213ywe.411.2023.10.25.14.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 14:21:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B50418181B92; Wed, 25 Oct 2023 14:21:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230400AbjJYVUw (ORCPT + 99 others); Wed, 25 Oct 2023 17:20:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230306AbjJYVUu (ORCPT ); Wed, 25 Oct 2023 17:20:50 -0400 Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [205.139.111.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C737C133 for ; Wed, 25 Oct 2023 14:20:46 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-56-w4m3W4JtM1qeNA1RPUeHUg-1; Wed, 25 Oct 2023 17:20:26 -0400 X-MC-Unique: w4m3W4JtM1qeNA1RPUeHUg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 277A7857CF6; Wed, 25 Oct 2023 21:20:26 +0000 (UTC) Received: from hog (unknown [10.39.192.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D12321121314; Wed, 25 Oct 2023 21:20:24 +0000 (UTC) Date: Wed, 25 Oct 2023 23:20:23 +0200 From: Sabrina Dubroca To: Jakub Kicinski 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: 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=utf-8 Content-Disposition: inline In-Reply-To: <20231025071408.3b33f733@kernel.org> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, 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 pete.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 (pete.vger.email [0.0.0.0]); Wed, 25 Oct 2023 14:21:01 -0700 (PDT) 2023-10-25, 07:14:08 -0700, Jakub Kicinski wrote: > On Wed, 25 Oct 2023 12:27:05 +0200 Sabrina Dubroca wrote: > > > My bad. I only checked &msg->msg_iter's address in tls_decrypt_sw and found > > > it was wrong. Do I need to make a new patch to fix the harmless bogus > > > pointer? > > > > I don't think that's necessary, but maybe it would avoid people trying > > to "fix" this code in the future. Jakub, WDYT? > > No strong feelings, but personally I find checks for conditions which > cannot happen decrease the readability. Maybe a comment is better? 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? -- Sabrina