Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp77089rdf; Thu, 2 Nov 2023 14:22:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPdEgDLw6sZANwBfE/hifEKP4Ik81YmB3mWBELTQ5WcIPM2r7ks7uaZYQQkjjFtk2U4eru X-Received: by 2002:a17:902:f34d:b0:1ca:e4b:148d with SMTP id q13-20020a170902f34d00b001ca0e4b148dmr13687705ple.65.1698960127997; Thu, 02 Nov 2023 14:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698960127; cv=none; d=google.com; s=arc-20160816; b=Ao9Q1RwoFjD0s0TX8SdssbPcxHut3JO+joMLrK0nUFpeknRfqc/ZZ6Z33PMIt0Ox/U hAsQtq4Q+e9pgyEcqkbTIrtvNIeeg3GxFLvYWUN0nlI5AFEN5MXzorTNRUSVZmIrHVTg hQFrKzOIHBERKP268K+QXurGF+XqRk/dC7MyH+08Qo1VaICrrDIadQFvkdNlLDyYj9H9 p0oQk7723Th/DPPrIGM0McI0r0ZQMOMFrja9/DuBJNhKDEKNdUxtF4egqP5F30o1HavV +ZSORt84ar47SBHYBLbvz4quPfdCy6FvVVqUET/nkgGqQ3MaiA8hUtYqvoc3INnfh7zf LPrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=lug65i9SpeCxzvrYTmUZ5JS3Ay8/Kn/DlLaH6z3IhH8=; fh=+C0vf24H4i1wr/34Q+wblx7eEZ06+etfDT7c36ll7Wo=; b=Z5sYVjbmRIHNdL+lSilGsMhYZxn9WVtc5rfTjHqxAfPmmJOg7Viv1itJo6BRToDwDY orOUxUMUGqvZ9R812c73gS0QWbDIGYWcjXXj00878K/KXOvlXAuZaKJz0ZLr1IFx/L3r jchKpOuZ7abzFyA2Vg4+jim9WcxKhNerS33Odlgs/01CokYxdxu5lWcUO+O6zdlx8SIc zLVmXxLM4TtEN8udqYmn8lfwH14ctKCMhJ3ZNwkFwNZyJuWW+5AKEovvlgSNYAm7Y11C YapG5R6eRm3vm8g15pEPOHcg4kPfa6zMeOBxOd4gjNWD7fkYnM1xAoM6Qe+sonCfSJC5 xVSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=eVip9fRF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id w15-20020a170902e88f00b001b5589848absi294210plg.234.2023.11.02.14.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 14:22:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=eVip9fRF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C49B68077983; Thu, 2 Nov 2023 14:22:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbjKBVWF (ORCPT + 99 others); Thu, 2 Nov 2023 17:22:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230015AbjKBVWB (ORCPT ); Thu, 2 Nov 2023 17:22:01 -0400 Received: from smtp.smtpout.orange.fr (smtp-30.smtpout.orange.fr [80.12.242.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C49196 for ; Thu, 2 Nov 2023 14:21:56 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id yf8Rqp7S1uQcKyf8RqIfdN; Thu, 02 Nov 2023 22:21:53 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1698960113; bh=lug65i9SpeCxzvrYTmUZ5JS3Ay8/Kn/DlLaH6z3IhH8=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=eVip9fRFNHWDPpYoUlO67CGTnE5aVD6Ok7JeiqTgUzBtEMpoqVHN+1iWRvnokiG2P czruQufq+8nreAWpibk4+WCd0Cov/lPQcJscEMSSMIEsGh8ALpTUebqffPgeqChcsa 8Exa7B9LYwVUUUI3w/nzuwfcyAVZislOh6guKhCm1zo2tAqiziVgvhsFGYkOKjUvqH T2oJvZ6DEF/ZkAavYyvi2zpKPutTtFhampzhJAT2KPhF0rq74P8jcTAFL5Qtd8VNQE sTWWEvkjWSU9Ki5PRahWbR1gIO0DZ0Nzmjtp0pRIfju6UwwxLQgsB5ayjX/WpXEdTi GiHD3fvjEeAdg== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 02 Nov 2023 22:21:53 +0100 X-ME-IP: 86.243.2.178 Message-ID: <95fdad28-95d5-4720-811b-8bbef8600830@wanadoo.fr> Date: Thu, 2 Nov 2023 22:21:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] vboxsf: Avoid an spurious warning if load_nls_xxx() fails To: Matthew Wilcox Cc: Hans de Goede , Christoph Hellwig , Al Viro , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-fsdevel@vger.kernel.org References: Content-Language: fr, en-US From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 02 Nov 2023 14:22:06 -0700 (PDT) Le 02/11/2023 à 13:30, Matthew Wilcox a écrit : > On Wed, Nov 01, 2023 at 11:49:48AM +0100, Christophe JAILLET wrote: >> If an load_nls_xxx() function fails a few lines above, the 'sbi->bdi_id' is >> still 0. >> So, in the error handling path, we will call ida_simple_remove(..., 0) >> which is not allocated yet. >> >> In order to prevent a spurious "ida_free called for id=0 which is not >> allocated." message, tweak the error handling path and add a new label. > > That's not spurious! My fault, as a non-native English speaking man. I've always sought that spurious was meaning "odd" or "strange", but I was wrong :( Here, a better wording could be "to prevent an un-expected "ida..."". Is that ok for you? Or the last sentence could shortened to only "In order to fix it, tweak the error handling path and add a new label.". CJ > You're freeing something that wasn't allocated. > A good quality malloc allocation will warn you if you free() a random > pointer. I agree with everything abuot this patch (and the next) except > for the changelog. > >> Fixes: 0fd169576648 ("fs: Add VirtualBox guest shared folder (vboxsf) support") >> Signed-off-by: Christophe JAILLET >> --- >> fs/vboxsf/super.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/fs/vboxsf/super.c b/fs/vboxsf/super.c >> index 1fb8f4df60cb..9848af78215b 100644 >> --- a/fs/vboxsf/super.c >> +++ b/fs/vboxsf/super.c >> @@ -151,7 +151,7 @@ static int vboxsf_fill_super(struct super_block *sb, struct fs_context *fc) >> if (!sbi->nls) { >> vbg_err("vboxsf: Count not load '%s' nls\n", nls_name); >> err = -EINVAL; >> - goto fail_free; >> + goto fail_destroy_idr; >> } >> } >> >> @@ -224,6 +224,7 @@ static int vboxsf_fill_super(struct super_block *sb, struct fs_context *fc) >> ida_simple_remove(&vboxsf_bdi_ida, sbi->bdi_id); >> if (sbi->nls) >> unload_nls(sbi->nls); >> +fail_destroy_idr: >> idr_destroy(&sbi->ino_idr); >> kfree(sbi); >> return err; >> -- >> 2.34.1 >> >> > >