Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1064654rdb; Sun, 7 Jan 2024 01:48:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtrPcj+hIxe63XtUOPh5P0Hv5ggtUJjcEE3w7TZ5+E+gyZLHHYqPNLIE6UNiJM8lI0xkSH X-Received: by 2002:a05:6a00:2e9e:b0:6d9:396d:730b with SMTP id fd30-20020a056a002e9e00b006d9396d730bmr2591648pfb.27.1704620913939; Sun, 07 Jan 2024 01:48:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704620913; cv=none; d=google.com; s=arc-20160816; b=OI3WrGERungh6cZGfp6/5p4rKL56NcCeQSQx7A1AIik7IgoTaepVY4XkvG05Faaylm khUz20+ve8ghVLDCvovGDpyYbbR/0gwyWaLm/avoJvHDCdlcU0WzqTI9RR7LiAtfTa+h p6IIEa2N5dg0bqBKry7jOpwF4Rm/DnRWyVcCzYuUYmVAYJSyCKp+aXyWFcJWiDVZSRyt ehyBJ77ukRND3roPGTLRcE5pgHv7CVB0vizfa4y75kSMQI2OL9yqzFgqUf3lFjMKU3N3 jAOfeExNzM1+lqK7OzxxbQu2B+ZPIRj3vF3VsfSbP11w1TAY154PlacwoZPQVer3acE+ NFVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-filter; bh=nSwVIYsyGEAHAk7Jdk8Kvbtt6T8ksFe0fmlfwjsnNpk=; fh=kSC/YMlV4lyeVtWOJDHmRK71F3U7r2d0E926FoY5Xt0=; b=c0gRlgGMGpWEEBZCZrCgq9YiLmq3kYLX08HjqODFP43jYwEOgXKTy5rD7gj5lqDf3X GKqPj27ab1UydMAI2ZWW2NbPYVjzT8hrRhVYG3fLvadkDOLwc6ts/tFipHC5GimD3HDK s1T1IN1yZiKeiKSwpI73bo6zfzndnyc8bVqzmsR6JUQ66D0/WKm6182CjCyygVyPsurz ygNJ+UXslRqRtpoJE42tkFq82ayNoc0uuBK6zIi5I6sTNx+0POupfnXFHnXvhUU6kpWy AtisNKVqrc3cXev5E7/Q4FGWRQRUdWwIGp504ew2hFyRi7eF8cfRpZkzG2kgaAUPQLGu vk7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=G05DGoO0; spf=pass (google.com: domain of linux-kernel+bounces-18824-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18824-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ay23-20020a056a00301700b006d9bf6f20efsi4307043pfb.170.2024.01.07.01.48.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jan 2024 01:48:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18824-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=G05DGoO0; spf=pass (google.com: domain of linux-kernel+bounces-18824-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18824-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 162B228288C for ; Sun, 7 Jan 2024 09:48:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 806B912B84; Sun, 7 Jan 2024 09:48:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b="G05DGoO0" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7696812B60; Sun, 7 Jan 2024 09:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ispras.ru Received: from localhost (unknown [46.242.8.170]) by mail.ispras.ru (Postfix) with ESMTPSA id 577A040F1DDC; Sun, 7 Jan 2024 09:48:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 577A040F1DDC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1704620892; bh=nSwVIYsyGEAHAk7Jdk8Kvbtt6T8ksFe0fmlfwjsnNpk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=G05DGoO0spAWfn4u4wUPmftj1IkLpD4EaeF5cTZt0lRp6WKrgpK54N3SBwoKEqNo8 RmQi6Dv37waC4A6S7kVjAvcoCXrSo5D89g8YYaYyF9hYJ7dz9oL64NcqDs4TPdhKDS oUSBaO3IhWThSxQ/7vL1FdN7l0PebhpnV26jFPxM= Date: Sun, 7 Jan 2024 12:48:11 +0300 From: Fedor Pchelkin To: Vitaly Chikunov Cc: Dominique Martinet , Christian Schoenebeck , Eric Van Hensbergen , Latchesar Ionkov , "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: Re: [PATCH v4] net: 9p: avoid freeing uninit memory in p9pdu_vreadf Message-ID: <0e725e7f-00af-4708-8250-f15fb7c7b08e-pchelkin@ispras.ru> References: <20231206200913.16135-1-pchelkin@ispras.ru> <1808202.Umia7laAZq@silver> <2et72smsvglzicqsyvt5m7bx2akyqzi2moq7tjupppygbsme3u@o2sltttok5wy> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2et72smsvglzicqsyvt5m7bx2akyqzi2moq7tjupppygbsme3u@o2sltttok5wy> On 24/01/07 10:56AM, Vitaly Chikunov wrote: > Dominique, > > On Tue, Dec 12, 2023 at 08:21:30AM +0900, Dominique Martinet wrote: > > Christian Schoenebeck wrote on Thu, Dec 07, 2023 at 01:54:02PM +0100: > > > I just checked whether this could create a leak, but it looks clean, so LGTM: > > > > Right, either version look good to me. > > Also, there was unnoticed bug in v2[1] - `int i` is moved to outer block > and `i` counld be used uninitialized inside of `if (errcode) {`. Could you elaborate, please? As I can see, `i` could be used uninitialized in `if (errcode) {` only when `*wnames` is not NULL. But when `*wnames` is not NULL, then `i` is initialized in the `for` loop. It is a bit tricky and not obvious from the first glance (and not the best decision after all), so with Christian's advice the patch was rewritten to v4 which was eventually accepted. The bug you've noticed exists in v1 of the patch, not v2. > Thanks, > > [1] https://lore.kernel.org/all/20231205091952.24754-1-pchelkin@ispras.ru/