Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1072350rdb; Sun, 7 Jan 2024 02:14:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJuIxtLb7UadKVyqAg1yhbReRnvBcTuBgGui2CjtlFh+d2Jx3X+lwkqSEpqM1mCnafW2P8 X-Received: by 2002:a05:6870:4150:b0:1fb:75a:6d2c with SMTP id r16-20020a056870415000b001fb075a6d2cmr3065412oad.83.1704622493379; Sun, 07 Jan 2024 02:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704622493; cv=none; d=google.com; s=arc-20160816; b=kU/bKFeoleVOudyzATMqo+KLGn1JdYvqNBdS2WUYBFBD31LbKjD9SczbiLZ7swomyQ iZ+f2eTSkgkVQyj941T0jcmKhH7LrHkvWFNMjyAguwpYb55m9o/StBHCqVHnuABawXOR GsLN4h/ISrgYnv23MVRaD1Yyj9L+el/FfKuO0UcCPHlKrXS5lyoIKmGzYiErNDgZJpJm XeY0h0fyCN0CuQg0UvYzRBAogz8QFuApMaF1coy+wOmvMCHUdTWL20+2dQzkqpwr371z ZOKahGWlc2DqUj6s3l/Sd/0hl19Tq+VLDo6+9BCYGZ0tnWpEJavOIEkmBBFsTf2E95UL xzOA== 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; bh=oHmI5ebpa9YnmBxlBtqO3W2HKhenmjvBM25pqUvl1Ro=; fh=U30VKRc+V/XJcJBCEM+mazaqMuFGQWBH7ybA9LumSwg=; b=zRUb1zJkxN5r0+vifU7/jv+k3zc+1vN+oF6RGIfpzzeGunPYpVIhhGDcZx8gf+H0e5 YJw+VWl1VcHrXEu6a5P8O2TMuEHhQm1c5/S7NFzXgBkDPv2wEmgBhrIlB41j9zbivMLt dQixMnddunekJOFSYtCHqCovqwSXo10dQaZ/6/T71ML/AJSRDq1+8kgiQL9hZKfpuN7a Rt9s9ScNEpwLHOpxDlLL5aXNI6MC1iGZCLsAZAxhykVpbTy6MVj3tkbQTm5h2RgN2EZI CtRAPo18ohd8Yl+P2+BK+d/6UxBAt+POCaub+/KCkAKgH6uTMy+TRvdt+gMxNWRKlNI6 eYOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-18832-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18832-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s124-20020a637782000000b005ce01784672si4415743pgc.866.2024.01.07.02.14.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jan 2024 02:14:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18832-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-18832-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18832-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 853CFB21A17 for ; Sun, 7 Jan 2024 10:14:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B27E912B96; Sun, 7 Jan 2024 10:14:16 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF9E712B78; Sun, 7 Jan 2024 10:14:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=altlinux.org Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id 71DFD72C8CC; Sun, 7 Jan 2024 13:14:12 +0300 (MSK) Received: from altlinux.org (sole.flsd.net [185.75.180.6]) by imap.altlinux.org (Postfix) with ESMTPSA id 6048736D0170; Sun, 7 Jan 2024 13:14:12 +0300 (MSK) Date: Sun, 7 Jan 2024 13:14:12 +0300 From: Vitaly Chikunov To: Fedor Pchelkin 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: [PATCH v4] net: 9p: avoid freeing uninit memory in p9pdu_vreadf Message-ID: <20240107101412.av7ypbdstfudoejg@altlinux.org> References: <20231206200913.16135-1-pchelkin@ispras.ru> <1808202.Umia7laAZq@silver> <2et72smsvglzicqsyvt5m7bx2akyqzi2moq7tjupppygbsme3u@o2sltttok5wy> <0e725e7f-00af-4708-8250-f15fb7c7b08e-pchelkin@ispras.ru> 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=koi8-r Content-Disposition: inline In-Reply-To: <0e725e7f-00af-4708-8250-f15fb7c7b08e-pchelkin@ispras.ru> Fedor, On Sun, Jan 07, 2024 at 12:48:11PM +0300, Fedor Pchelkin wrote: > On 24/01/07 10:56AM, Vitaly Chikunov wrote: > > > > 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. You are right, it only affects v1. I didn't notice that important difference in v2. My excuses! Thanks, > > > Thanks, > > > > [1] https://lore.kernel.org/all/20231205091952.24754-1-pchelkin@ispras.ru/