Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3980799rdb; Mon, 11 Dec 2023 05:51:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+epG7puIn63Bjj1Q54iPRj2KBB/RbMwrBIlfrzFv/Zr2/J08qly4WX3cs93mgIrbCSty2 X-Received: by 2002:a17:902:7c02:b0:1d0:b37b:a1f8 with SMTP id x2-20020a1709027c0200b001d0b37ba1f8mr1722067pll.28.1702302718780; Mon, 11 Dec 2023 05:51:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702302718; cv=none; d=google.com; s=arc-20160816; b=mKsc10/XCVutHwobmGFga8OGEAdDT8XprknpVttxKDpf1eyt4WaPErmlwOzPYoXF8j fjrNvoHgWxWS+gGH+cHaZJjhDZTpkBEYTilNN4zWgndog/1cbNcXCN9DSsYVYZzKRlXQ WaI3tlM3I15ZPkeCMp4m+2daaMk3AAoUvhYKvBZM7TqtaaXilmQ2Ux3JylPurhr6lG3z s2Rhdoj6VM/KkeKDm9vT00iwYcS0nehGBTo96kOdO/ZX18QPCPuipozNkMHyPdrBRimT wB7QkPn1F9Di39muHaI3iG61k1R/TMMBTm30bLjAaNTpUIPHvEGdHg1v1kuB4CWvmaW0 5PBw== 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; bh=yJZ5Z9zH89G6LMF1wV53rNXkL6A9nUiNA64eqwYBaZE=; fh=U30VKRc+V/XJcJBCEM+mazaqMuFGQWBH7ybA9LumSwg=; b=dM7AT5Ww1fNBxFaY7IWPUEZylrcG8jpQ6/je5+JZCoE+/EOkGXkquqhnaknDU5kRo5 9048KBj28efF59RWqvBAZ8FiXxSEGQngr9TDdC0kl+1eLd3/mID9of+WQ8le/plzbhmP Kcmt61Kas+b/kJwssEx/PaGOEZNw68ZZOXueSicQQnW1EGoVLWXBAeIyxO30qWdfbC27 H+BK2mvhal6P050ROZUsYuUBxcmiUkNL8r6PTdvILUD8Z7EghYQJ6WqAe0A11Dy7Uzy+ SiUiI3CtoeBW7k7AThKZii3lNE88ESh9htLJHSt8Yz6f3tNnjxuF3JTQ7UR8h21bTB27 SDUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GZTaiK5H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k10-20020a170902694a00b001cc221d40e1si5951989plt.635.2023.12.11.05.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 05:51:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GZTaiK5H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id E0F57805FD20; Mon, 11 Dec 2023 05:51:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343631AbjLKNvn (ORCPT + 99 others); Mon, 11 Dec 2023 08:51:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234453AbjLKNvm (ORCPT ); Mon, 11 Dec 2023 08:51:42 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50A23C3 for ; Mon, 11 Dec 2023 05:51:49 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35FF9C433C7; Mon, 11 Dec 2023 13:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702302708; bh=nIyuqcp4+4582x1GA9+XcGxtdjfRCxJK9Ur7alA/OAw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GZTaiK5Hs1zkFuyL8Ccm4MUAI7dzy6fHvQtOQP5QeL4ZU8FE5u/fDIYOIYjBN3ksM VXLRHOlJrkSfItbJ0VGSaF6IZWFQ6e5ZAuJI2A8y665EGsp2SZi4bXQQjn1AhPRjT0 YrIoaxY7qCKLgO3d8G70VDMWfyVfQHUe1WI9J1EndI/O/RKfyUNwgVdAvj+QGgfSY1 qCMyOvDEoKi/uulMaVKNU5cAG8rytCsqDdDjic5hU7bp75KYKVlPIuzQiBdK+A9YuP Rhja9p0ckqfW5W70JKXViaS8WmchCK1QSc5pFkqul0qwZ+PFlE64nrz3SNx5l7Qsan 67WMgQtyjvfZw== Date: Mon, 11 Dec 2023 13:51:42 +0000 From: Simon Horman 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: <20231211135142.GO5817@kernel.org> References: <10981267.HhOBSzzNiN@silver> <20231206200913.16135-1-pchelkin@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231206200913.16135-1-pchelkin@ispras.ru> 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 11 Dec 2023 05:51:56 -0800 (PST) On Wed, Dec 06, 2023 at 11:09:13PM +0300, Fedor Pchelkin wrote: > If some of p9pdu_readf() calls inside case 'T' in p9pdu_vreadf() fails, > the error path is not handled properly. *wnames or members of *wnames > array may be left uninitialized and invalidly freed. > > Initialize *wnames to NULL in beginning of case 'T'. Initialize the first > *wnames array element to NULL and nullify the failing *wnames element so > that the error path freeing loop stops on the first NULL element and > doesn't proceed further. > > Found by Linux Verification Center (linuxtesting.org). > > Fixes: ace51c4dd2f9 ("9p: add new protocol support code") > Signed-off-by: Fedor Pchelkin Reviewed-by: Simon Horman