Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp161762rdb; Tue, 5 Dec 2023 01:32:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHM9gsIWRvHfMLeTTBImIHihVRdphZ7w9bRcpo+Yj5GkWzBYjtTL8MAp0pnNbFNvMUwDeTN X-Received: by 2002:a05:6a20:748a:b0:187:cf88:1a34 with SMTP id p10-20020a056a20748a00b00187cf881a34mr7644890pzd.8.1701768740331; Tue, 05 Dec 2023 01:32:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701768740; cv=none; d=google.com; s=arc-20160816; b=a0doR3vSaPNi8ZRMqIs3egMYxv1fEo2dptTsotyg3hFudZ8KY6KyDIGN5B0qCIk7Pp 9/Z5rmE0v3SmQdSC7fHCZcX9Tr2VXwOdZWV63IvIaYiKLhJdyxupE02WMGLP8mFNKY99 VQCU7eZcbGps6ymsXJpzUd01sKnFqbtf1sL2OMSWMQTiax26bIRsKn0xaf1qxgIotLQL gOgZgr9Efwud/pScg/vD948ESAYXDLfqA4XCIycdol9GEPoC0rz5g1/UA0px1ocLGgCU XgfnthAnZ8Pb81CNohFxkc1Wugh1+aync7ApdWIMY9ZZBAP+LiG9mk7CNq4d4NxQUq/l jeHA== 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:dkim-signature :dkim-signature; bh=Bcs2wqbN9pFVw67N2sNg9eeh6V11qjKxUE3FaK/pUSg=; fh=t6DIeRiLumsrOaOdPVvJm//iwsKIdQc2F+tgaxwzvMg=; b=fknbC1RlKbmXtHz8evlA+jIrTUF4VsPOw8OUqC9aaHx9robtq80iOHTwCfKvU/f9A4 uiDCZ91hDVDCkLhB8Lz+XI0qFlRzita9AWUYWhNcDORKqOlVJsTzonxs9iE/n47/Svr3 TSTWG0dU+elbR4+sZn28y1plTZ4m0CKxoKAgvmi+QWq/o77LHOLj/4aBQ6409/29T9NM Gb23sW1svzIule9b5IN2fUirzewnHrheyR+iICUp3rscDieAssPaqPiQVz9NjBP/HYb3 P4vCs8fOsJjLFd2A7ShGyr6981Eb4P+KCQN/+B6ZeKIaIy39hn+TiNth4/0JhJ3269ZJ zEOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=xFTMUKXr; dkim=pass header.i=@codewreck.org header.s=2 header.b=aW6B6SpX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id s20-20020a056a00195400b006cde431f380si2696393pfk.246.2023.12.05.01.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 01:32:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=xFTMUKXr; dkim=pass header.i=@codewreck.org header.s=2 header.b=aW6B6SpX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 039C48076651; Tue, 5 Dec 2023 01:32:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235485AbjLEJcD (ORCPT + 99 others); Tue, 5 Dec 2023 04:32:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235064AbjLEJcA (ORCPT ); Tue, 5 Dec 2023 04:32:00 -0500 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FE349B; Tue, 5 Dec 2023 01:32:06 -0800 (PST) Received: by nautica.notk.org (Postfix, from userid 108) id 4169FC022; Tue, 5 Dec 2023 10:32:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1701768725; bh=Bcs2wqbN9pFVw67N2sNg9eeh6V11qjKxUE3FaK/pUSg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xFTMUKXrihhDPAXEq6ldua3G1TG6BFCYfSdnMZVvsrIkdaiL5tRpFWgWUiHwXQSja lP3w87pKZyI+0ctVEoF51b8dm3zwwA+5fD8femtJakh9CThlmdMYGtNepsDc5ys2fV poR8aiWuxQu/DffkdVEbYPwBCMNq0EPJ3T9QOF6WSvrIaT9z4+/gn0x7Sl2ngtzmHy 1aenxesO023aylpNmoGXrs7cA1n7MKujJJfjzW5zlioIEuxKVsF2NNyypE2T+sm9pW SmLbAVEDeRQIsf11jpLmElPeFHS8Flas3P0oub32MoIDGUYmOPfBhRzeUqc3nUaAFc dA3/YWg7cN+HQ== X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 Received: from gaia (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id 7F8ECC009; Tue, 5 Dec 2023 10:32:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1701768724; bh=Bcs2wqbN9pFVw67N2sNg9eeh6V11qjKxUE3FaK/pUSg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aW6B6SpX7GCIFOKh1snzGGYDqWdOHLrB2fzRC5ZxtYbsQMtDsIpyZK8HIgMuCV+gj Bcn00mMZ+oGZNIpxt2G72E5g2rVJb84YmptEXh05b2Vio1Q48groPrD1wSAwS4mwig OQkEtroJPLaPmBRJMp3iNqdS5qZBXWe8GTfhNWYCXU+OBlGIZHBgMCWIHIsRuFvbuy qbrHrm9WkIrOaUcrKKLN23N47vaXfmRpokGhD1P5pREqAJWiGKSftubt96DIkFXaJR ZJe3EiVPELTs3epJmoDYarjYKUpfMEANLfR/0O3clADUtEWrYCQ46CgJt+ZFDCWlbd rhZ/Qvucjdv5w== Received: from localhost (gaia [local]) by gaia (OpenSMTPD) with ESMTPA id 8d6a1af9; Tue, 5 Dec 2023 09:31:57 +0000 (UTC) Date: Tue, 5 Dec 2023 18:31:42 +0900 From: Dominique Martinet To: Fedor Pchelkin Cc: Latchesar Ionkov , Eric Van Hensbergen , Christian Schoenebeck , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , v9fs@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Khoroshilov , lvc-project@linuxtesting.org Subject: Re: [PATCH v2] net: 9p: avoid freeing uninit memory in p9pdu_vreadf Message-ID: References: <20231205091952.24754-1-pchelkin@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231205091952.24754-1-pchelkin@ispras.ru> 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 (groat.vger.email [0.0.0.0]); Tue, 05 Dec 2023 01:32:18 -0800 (PST) Fedor Pchelkin wrote on Tue, Dec 05, 2023 at 12:19:50PM +0300: > If an error occurs while processing an array of strings in p9pdu_vreadf > then uninitialized members of *wnames array are freed. > > Fix this by iterating over only lower indices of the array. Also handle > possible uninit *wnames usage if first p9pdu_readf() call inside 'T' case > fails. > > Found by Linux Verification Center (linuxtesting.org). > > Fixes: ace51c4dd2f9 ("9p: add new protocol support code") > Signed-off-by: Fedor Pchelkin > --- > v2: I've missed that *wnames can also be left uninitialized. Please > ignore the patch v1. While I agree it's good to initialize it in general, how is that a problem here? Do we have users that'd ignore the return code and try to use *wnames? (The first initialization is required in case the first p9pdu_readf fails and *wnames had a non-null initial value, but the second is unrelated) I don't mind the change even if there isn't but let's add a word in the commit message. > As an answer to Dominique's comment: my organization marks this > statement in all commits. Fair enough, I think you'd get more internet points with a 'Reported-by' but I see plenty of such messages in old commits and this isn't something I want to argue about -- ok. -- Dominique Martinet | Asmadeus