Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3560371pxb; Mon, 1 Mar 2021 13:21:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxsVzHiMZOCBnIRuT8ZnE0HNwucv9HShZ6bnblYA5dneNRhuKWRS661OCvJcdN7fJhCwPr9 X-Received: by 2002:a17:907:2112:: with SMTP id qn18mr9103658ejb.220.1614633713363; Mon, 01 Mar 2021 13:21:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614633713; cv=none; d=google.com; s=arc-20160816; b=Ut/j9SD6aDCNN9oMgix98Ro1uIhEBcHpEecYuos9fZ7yKyUea9vr9FJCw7i2hLN7vv 19dl6s5SRdcC39Il2t1os2DayuUpkZmrxn5DyANvFIYNc7Q1LoRgXHVclZqmRQrIgFgv Kv661HpJ9JOMhVu3DM6lVr2FAOWmf5ptQTbvHTIU3fKkHF9a79tj8ucDUgxbjQ85KAQL VzylJ6vplVDyReYIAWexyLtJ/aFYO2NbilDxiYT9Y4zgcST8JXBUmPnmnl2N0i5Y5xcb M2ecpFqN4MCuF2Xt3w/XRxnM3+dLiH9+EjwPa90T6Fz+WY7+9Wvnwkziv2elneeOYOnq UrHQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9IvYHn4DphL08nlkEMKXJI0m871IT1juFdP6e/LBXUo=; b=QY5OnshKJ6kLWTwieylCAZlukEtn6DC5W+w0d68/Ic+y5A+lWN1D/0DjW1hs8k1d93 KKA2gUR/30tFFKJlGM37cVk74R/Ez6gERC3r0p0ruX3MKbvqrm4gLNIzIUcO6UwOoRB+ 0e6JKDA0wcR0FpsrN+GaDVIgcuC3xNg1fZLUYbsn5tvZ/rB46VHAqhs2NAhKYcCirUT3 GwwSOjURey/6TsIJrrJ0RjacIlCWe++kGpt/GCCSabhVcTV8MpJgqEh3b0p+w97BDslD ipKSh2c1nbzNfWy6Ib41MnkkdpDaKR5jSb7rJNrFpxzEaABGy6dQb6EawIQ2C7Uv+oNi ExnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R58ojUX2; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h20si12237256ejy.416.2021.03.01.13.21.30; Mon, 01 Mar 2021 13:21:53 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=R58ojUX2; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244396AbhCAVTI (ORCPT + 99 others); Mon, 1 Mar 2021 16:19:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:48316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234806AbhCARPo (ORCPT ); Mon, 1 Mar 2021 12:15:44 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2FCBA65045; Mon, 1 Mar 2021 16:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617148; bh=EP4oZj3kW/2Ml7JpJzN8pbUf8lXxjfZ55o/PU8s51sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R58ojUX26KfArtiw+zBIV3UyUWQcfmGh5jIquRYk+6SYUmCXLgys2+fo8Rlw+1rmL FdWE9mmg0nWF3RjWERPJz37ZMLLHKCFrhQIb/Pu7lQuAssP1XagvliISI5R87kVoPj mYAjObFmo13ZHWAu0zbrz3QCuhyimz8QN9RER1tc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , David Sterba Subject: [PATCH 4.19 218/247] fs/affs: release old buffer head on error path Date: Mon, 1 Mar 2021 17:13:58 +0100 Message-Id: <20210301161042.346872751@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pan Bian commit 70779b897395b330ba5a47bed84f94178da599f9 upstream. The reference count of the old buffer head should be decremented on path that fails to get the new buffer head. Fixes: 6b4657667ba0 ("fs/affs: add rename exchange") CC: stable@vger.kernel.org # 4.14+ Signed-off-by: Pan Bian Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/affs/namei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/affs/namei.c +++ b/fs/affs/namei.c @@ -460,8 +460,10 @@ affs_xrename(struct inode *old_dir, stru return -EIO; bh_new = affs_bread(sb, d_inode(new_dentry)->i_ino); - if (!bh_new) + if (!bh_new) { + affs_brelse(bh_old); return -EIO; + } /* Remove old header from its parent directory. */ affs_lock_dir(old_dir);