Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp341037rdb; Thu, 2 Nov 2023 05:30:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCuZVqSbQo+otp7ZNVFBKpRQpomlTvokPJ0p+N3BtkXwHM/PziJacNvXRu8+S/xjuFzf4w X-Received: by 2002:a17:902:ec88:b0:1cc:68c4:8c60 with SMTP id x8-20020a170902ec8800b001cc68c48c60mr7956904plg.18.1698928252637; Thu, 02 Nov 2023 05:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698928252; cv=none; d=google.com; s=arc-20160816; b=bVWypdw44BuCdputUm56oU1kMpgZDAUqsxgYCGcIQHlpLpG9lXLv8nRv+aQqr+ODNq gxFyvXr+nq7+bgEjUCIgkb9umwcKZfsOK3Yn7RXqF5QGNZJxfLKIZ0SXunsdie5PAKhW /tKauM2lrOxrL/PCXyimqllMhJ+X040vObM64+/9eBYM8/06VTWxTPsRaQAILHRsBKfq j1EZ9xpYy8lYN1oObNxalHOmC3oVUmz/8Qc5KG46ONV/ghm5eNMVsqdpa23XwRTlg8Iz TyURxazjV6xBXu+gothBFqpMNU6HN9sripHvtmjBi4lmztbuGhV69KEqgKJmSxc1dSeE DplA== 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=lLbEJjW9cmFlpV3shV0/lRN5bbIbbVeY+zCDD51WFMw=; fh=mVdzv/X23x1MQa0VnKDSKP2+aSaC4xSmlM+1J6hr/gg=; b=OIcXDdbhkyuNAMJlBgntvqEX5y+RvBRydLYoDqll8NIKjd0ZKTjnVy1DaQvqoQyyRZ oPqnnV2VO2edUvOQOOiO9ul5G07d3c1RGGIhPQAMpZiGlA8uBJ8awYrLxhpfX5y9tNc4 ur0H91yAvRUHLCn0xUOk+rU3FkmS/Rjayypc8VVSsHHA6TTPFJyXNDPal7CwG93gkHpQ xSYOicqaYVGk4iA7J6QkNRgRpAXI1YM5LJcFpFp+AJYLLgUXSuAPXROFsydf0GPkKOKY UyJBCr/sgO0JbexDvevwZfCwDB+RT4b8lfxuvBnZiN47nf+2Igp9PCsdZtsJ66o40Hlg G6aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pTHDt05l; 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 Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id y4-20020a17090322c400b001cad3a744aesi5154922plg.153.2023.11.02.05.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 05:30:52 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b=pTHDt05l; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 89DE38028530; Thu, 2 Nov 2023 05:30:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376286AbjKBMaU (ORCPT + 99 others); Thu, 2 Nov 2023 08:30:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347475AbjKBMaS (ORCPT ); Thu, 2 Nov 2023 08:30:18 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B96F4137; Thu, 2 Nov 2023 05:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lLbEJjW9cmFlpV3shV0/lRN5bbIbbVeY+zCDD51WFMw=; b=pTHDt05lcN/Cquxk27BSdyCKgy hzNRR4QinKiGSXAT+IvNDIldJJss87ffYgIHYqGWe7fkQJzfVfWVAmqcKYjo5QW15CWq0u59MUihn h2bKPJMu4MRWcgPl8ZiIlyIEoGDnEougjsws6T/D40F/HB6pPn+HJTg62MGa5fiRnKOvCbXPhzsSh tRaYFDh46FTFcvpSzkTKCviXehU/1CUav+ATjAzMWf5BC/65dJTg5yFLVYZ1U4bHiTU7OoCJBejvv 63covoTNDX8ZnRkSKNGOtl2gkFc4ePV5QLeaNOdmdnfFQK3GRq+bFLrxvs56WghPaAURYyAAsZZ12 7Ch5wJxQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qyWpn-004Qbg-9a; Thu, 02 Nov 2023 12:30:03 +0000 Date: Thu, 2 Nov 2023 12:30:03 +0000 From: Matthew Wilcox To: Christophe JAILLET Cc: Hans de Goede , Christoph Hellwig , Al Viro , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 1/2] vboxsf: Avoid an spurious warning if load_nls_xxx() fails Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Thu, 02 Nov 2023 05:30:41 -0700 (PDT) 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! 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 > >