Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp478557pxv; Wed, 30 Jun 2021 09:51:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUZ/XZk/pmDgrsh1LemtiIGrHSbsOPtyn7oFecv8ezZDPJfHStxcinD3BibgYGS9mvPIMv X-Received: by 2002:a02:8241:: with SMTP id q1mr9614007jag.134.1625071914825; Wed, 30 Jun 2021 09:51:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625071914; cv=none; d=google.com; s=arc-20160816; b=OFQoFkT7ihQraoAZvMufHK0bTK07yqNcU/8A+AnEPVjA/m9f/wDzITGQSZAjMmuBmc 7BUa4BIAjlcb6Bvt6fuv5cc13OH6Xi0soSdFminLylkYqFjIVEvWXKZwCdHJcE/ePqXn R+BIyDJew/g7WNAB7KwuVhQychlJG09ElNgTpByU0C9k+RZYfhqrQDcRYdrdKY+W9XNs Cic+F7iKyp3VO2Wf+CLHgqLT4MpJuipoH5J/lC/paALHEV+GKa5Ky8qJOOkLYVUd9nl4 8t4+Vu69JqGMegrlWd9rFGOF49BWs/wH6muTiBXQz60djlm128//H91keLnuFP7gA6Hq TNzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=rrCOm25/wEcGs4N+ignfWeXZ6vUmh9jcEMLQbvJ5br4=; b=V7p/pNx6cqmxdsHObzxnMPkcDmtUsvpZn/N5Uy3ycwTMwrQqyL6ynRA6dReX3E6Fp/ 8Bukri87bakODxP0WhdDfzjYgEXoCSy1xcOkWnS6+Q83LKD4Cf7XbjQUvi/dyYW8dK8F g7uBHcVmUZslWaeb8Bjp23uaz+7Op6qij38oeA0ZYZyoyovosT6C9ISJTjqMnUpqqXyu SHHqILPHHWM59P+ua9EliJkuAlQ9UfTazwyG9CUk5KZYpqy69C6Z7/7hQDcCJgSXlagE a6cIexnuDhKiQnxm+HWZKzqyyowpojUMcljKed9nweeJx8J78pS1SAs9uSVhezjY1QOr 2BJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dubeyko-com.20150623.gappssmtp.com header.s=20150623 header.b=eeQo4foS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t15si24439036jai.117.2021.06.30.09.51.42; Wed, 30 Jun 2021 09:51:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@dubeyko-com.20150623.gappssmtp.com header.s=20150623 header.b=eeQo4foS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231879AbhF3Qv6 (ORCPT + 99 others); Wed, 30 Jun 2021 12:51:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbhF3Qv6 (ORCPT ); Wed, 30 Jun 2021 12:51:58 -0400 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E88ABC0617A8 for ; Wed, 30 Jun 2021 09:49:28 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id 22so3743476oix.10 for ; Wed, 30 Jun 2021 09:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dubeyko-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=rrCOm25/wEcGs4N+ignfWeXZ6vUmh9jcEMLQbvJ5br4=; b=eeQo4foSw6TAL6FybAfTFXaZWU/NCyKYkJO4+IOMa4MbGuIZpeRjBq3Qm0T552EbpO wTBJ2SukQsb0mP4tJ93zV3BYWnc9E7eqTqld7VYYhhw3nonsoA+Zqz9zyT1s6GhK9E7G 0dSoemF1Zm3Q3U6Fym+KRbHg0yu/Sk5dyzkrfr/3Lmh1xYQpFkFVx40LroJ0tO0paIcP 5hjTunf7Q7KwPNPmx7Tubjo0sUdQxInBItfmm//y2ISs+CvVl5wAoCuJiTZSDGv+pwc0 Kmo4oyuwT+0vC0T5yf7mzVMwO+D8r9RgXBarR72UO8D2F1RPczkORPEA7qUdAuDmBe4c Jukw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=rrCOm25/wEcGs4N+ignfWeXZ6vUmh9jcEMLQbvJ5br4=; b=fddijj+1wLTVpVy75kLux0ZwS+TVFOlmKZ1JrbHueOEHU3bkJiUQV17dql3YQiQM3l mCTJl4XjZUAJbXsCTcMxKr0z7saRJUunfXkJRlYcSFW8FGxYJUBEjfntGpaFdu13EOBk S/Gp1n6ozj0eZtHvQoOezDT0N4b+59cM+Ln+5l2TLIiVeJ3B3QjdGkbiPAA7VfAS5hYJ PL4R9Pcp+tiHyWq7gJjKdTnlzCn+fFDWQScSYzO16OEkzDSRtjDiFqKbiosdZ3hV5KWP U70lsGnij/i49xSbT9nj5hnqP+Eg4PTHT/P2YVc/guWsktUCcEQjkLcbWwGi/ZhM23t0 o3tw== X-Gm-Message-State: AOAM531rHYWLePat/OcWBDSCyt4GiNon8cfQPXZmP3ya1rrPNARWawaK MFgBIhJavwYaT30H7cEA6kC7sQ== X-Received: by 2002:a54:408b:: with SMTP id i11mr3666320oii.67.1625071768326; Wed, 30 Jun 2021 09:49:28 -0700 (PDT) Received: from smtpclient.apple ([2600:1700:42f0:6600:f8e3:a853:8646:6bc8]) by smtp.gmail.com with ESMTPSA id o25sm4650028ood.20.2021.06.30.09.49.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jun 2021 09:49:27 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: [PATCH 1/3] hfs: add missing clean-up in hfs_fill_super From: Viacheslav Dubeyko In-Reply-To: <6c6d6cd8-b8b3-54a9-f0bd-b36220caba26@gmail.com> Date: Wed, 30 Jun 2021 09:49:26 -0700 Cc: gustavoars@kernel.org, Al Viro , Linux FS Devel , LKML , skhan@linuxfoundation.org, gregkh@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org Content-Transfer-Encoding: quoted-printable Message-Id: <19A0D984-2817-44C5-87AE-6C2BF2310671@dubeyko.com> References: <20210629144803.62541-1-desmondcheongzx@gmail.com> <20210629144803.62541-2-desmondcheongzx@gmail.com> <28CCF4E3-51D1-43BE-A2BA-4708175A59C0@dubeyko.com> <6c6d6cd8-b8b3-54a9-f0bd-b36220caba26@gmail.com> To: Desmond Cheong Zhi Xi X-Mailer: Apple Mail (2.3654.100.0.2.22) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jun 29, 2021, at 9:50 PM, Desmond Cheong Zhi Xi = wrote: > Thanks for the suggestion. Since the bail and bail_no_root error paths = are used before hfs_find_init and after hfs_find_exit are called in the = normal execution case, moving hfs_find_exit under the bail label = wouldn't work. >=20 > Perhaps this can be done by introducing another goto label. Any = thoughts on the following? >=20 > diff --git a/fs/hfs/super.c b/fs/hfs/super.c > index 44d07c9e3a7f..12d9bae39363 100644 > --- a/fs/hfs/super.c > +++ b/fs/hfs/super.c > @@ -420,14 +420,12 @@ static int hfs_fill_super(struct super_block = *sb, void *data, int silent) > if (!res) { > if (fd.entrylength > sizeof(rec) || fd.entrylength < 0) = { > res =3D -EIO; > - goto bail; > + goto bail_hfs_find; > } > hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, = fd.entrylength); > } > - if (res) { > - hfs_find_exit(&fd); > - goto bail_no_root; > - } > + if (res) > + goto bail_hfs_find; > res =3D -EINVAL; > root_inode =3D hfs_iget(sb, &fd.search_key->cat, &rec); > hfs_find_exit(&fd); > @@ -443,6 +441,8 @@ static int hfs_fill_super(struct super_block *sb, = void *data, int silent) > /* everything's okay */ > return 0; >=20 > +bail_hfs_find: > + hfs_find_exit(&fd); > bail_no_root: > pr_err("get root inode failed\n"); > bail: Makes sense. Looks good. Thanks, Slava.