Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp255715pxv; Wed, 30 Jun 2021 20:09:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxVaMD9UxvzalOL7hki17KTvtFWQoiV6ZlyX5Yd4vpz6n/GBSRWUv7G+AKki+fI50/Xe2H X-Received: by 2002:a05:6e02:1292:: with SMTP id y18mr188128ilq.30.1625108976822; Wed, 30 Jun 2021 20:09:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625108976; cv=none; d=google.com; s=arc-20160816; b=wscAYgoiFDZ9IDze8OTRRPbBX83DF//SZnjgM6XkS2k7yQGofwbjeTQoQiggNt7hHZ SJZ2d1EDMCY6epUgB1u5B3jGseAVG17P10+axr/dx+P/AwalEuJoiU0OkYPDSKq96/qy 1TO2CC/6oTM1lNbsMOqu4RzJOiRf1j/5nW1hqT+ObXSg7zWmC4gqyP4EyS78srkI+RWv hUI9mmZIcz14XClDjQ5dpi8lFrmwBlYpRafF15ZzG0m9hfyq4G0aRasD388ZykNpI9Xk F51Rjw0oIdDta6it4UMxWisHrlXngWe5fwbkcebGOZKuCxzmU4XyhzKMTlYS+XMDXWez iDCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1cEkAa62CvZ4mqbyDK6dMhTfrSLLUVAknl5Ed3GLxXY=; b=cwfA3Ju3pX0z4X3fNH36eKeNYRQdYdjl6XK9wHbebA/LYPWOOnnSwEGc6S1JHCv8I1 XFT0B/ErBw8L9uPaRJrnfKGOl5vdFKAWlmars2RKPwHGCp852jfNtbTzt4uqh2YJ8JOw 6IlCOucJs0i4BQMqohpwi0nGXnmy8PuYA9Jz9ntdIsPLvl86a0k+EMJ1nO8IZZJYVisr 4roh1ndpOwA1Rln9yW35LT6gF74i4p99qAq9p5UFqSM7v7S1qXjMIbVmXJgo8JJJhSif slJ38CckGUilrHKO4FlkrpKy0t+4me+IC95X3AlCMAJXeZ3dzdb4YVWucdFfz6sYBs3Z w8Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RYJGK5U6; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 69si12908801ioc.46.2021.06.30.20.09.24; Wed, 30 Jun 2021 20:09:36 -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=@gmail.com header.s=20161025 header.b=RYJGK5U6; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238735AbhGADLE (ORCPT + 99 others); Wed, 30 Jun 2021 23:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238682AbhGADLD (ORCPT ); Wed, 30 Jun 2021 23:11:03 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF9E1C061756; Wed, 30 Jun 2021 20:08:33 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id c5so4632413pfv.8; Wed, 30 Jun 2021 20:08:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1cEkAa62CvZ4mqbyDK6dMhTfrSLLUVAknl5Ed3GLxXY=; b=RYJGK5U6C3aJ8oaLUZhKwUgDvk9IelyGC/2kx/3d7VY6LYQtL65EyuUK99POf9F/vl p1HkyjQ3une836usUBEmliDY8L2mUl8q14kPcD8m91PELFJoLOXtgfNu0he2YPpCch/M PWVd7gij6Oni9HBxCWOG1lQNu6AIO2lKGXJiYDvQxGKB7c0BiefqmJzRf79KYnqqdbml 70DsLsKu69HTZm5CtZ1ayU3ZyDfB1UhuIwGnIZ0uxhwdOaz2H5E7uMPRiILrmF9ibTKu m83DyuqmPD7kgV/G7e7RQy7YDmtrHFZsFHyvB30Io+/tjUCaG7Mx1nVcbPsA+D7QNI3t IqIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1cEkAa62CvZ4mqbyDK6dMhTfrSLLUVAknl5Ed3GLxXY=; b=p3Biz13mX4qcCbem+cVN3CdSMOoEE1UMsMLwc5U8YL1V9DjXJ2hDa6XvZM9j18qa/s LZsNDxtTlxlfxn9Pt/IOIA97DbsIISsMvLcVqL5XX022n5pjgmkvPQ+jD+opQ5aKVY/+ LxaTJ9iTTl4mY4eLWLNidWvxKbKekZjWfhzCeRulBJ+GuXRFT0VpSj9KX/U4DnCS/Bcr LTiJPY9XnB7RCe2JnTy3GoorVHcMlEZr92fL17NLDj6l6H/v5aAhjasJXz5u/G4ZuZxC KOqMW0QPi21Qyqm5AmzEfRLCUCErWHlp8fgIthGTvFQ5QfUZmBjkG817+dvK6jiU6Kwt LFbw== X-Gm-Message-State: AOAM531s+ABpBBep+nfsVPP772Kzo/jVEOSfUdIahe6aXjavzdHCtm4J NqqSI76Nbk+kkskou7NIRmtLUXz21a+UNcyhaa8= X-Received: by 2002:a05:6a00:1898:b029:310:9cd3:7bf8 with SMTP id x24-20020a056a001898b02903109cd37bf8mr3901910pfh.12.1625108913546; Wed, 30 Jun 2021 20:08:33 -0700 (PDT) Received: from localhost.localdomain ([118.200.190.93]) by smtp.gmail.com with ESMTPSA id g10sm4568568pjv.46.2021.06.30.20.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 20:08:33 -0700 (PDT) From: Desmond Cheong Zhi Xi To: gustavoars@kernel.org, viro@zeniv.linux.org.uk Cc: Desmond Cheong Zhi Xi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, slava@dubeyko.com, skhan@linuxfoundation.org, gregkh@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: [PATCH v2 1/3] hfs: add missing clean-up in hfs_fill_super Date: Thu, 1 Jul 2021 11:07:54 +0800 Message-Id: <20210701030756.58760-2-desmondcheongzx@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701030756.58760-1-desmondcheongzx@gmail.com> References: <20210701030756.58760-1-desmondcheongzx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Before exiting hfs_fill_super, the struct hfs_find_data used in hfs_find_init should be passed to hfs_find_exit to be cleaned up, and to release the lock held on the btree. The call to hfs_find_exit is missing from an error path. We add it back in by consolidating calls to hfs_find_exit for error paths. Signed-off-by: Desmond Cheong Zhi Xi --- fs/hfs/super.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 = -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 = -EINVAL; root_inode = 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; +bail_hfs_find: + hfs_find_exit(&fd); bail_no_root: pr_err("get root inode failed\n"); bail: -- 2.25.1