Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp273597yba; Mon, 20 May 2019 08:29:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyU8GIaZDf+yQnGw1KIxMiyLzuX6z3sONwBOK77OikDcn7/yvid19QLa4UVaIyVGMBmC2M9 X-Received: by 2002:a17:902:7488:: with SMTP id h8mr41680183pll.315.1558366146434; Mon, 20 May 2019 08:29:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558366146; cv=none; d=google.com; s=arc-20160816; b=fxXgSes8q1OcxH6XfLiqB4zzNLtuoPGE9FMjb224A0YA29KDH6OkzcQ/VNcvYe0ald qVvRDBNYXWbj3OtIH0gei2DXUNY4czl13kS1P/ieps6kjXGWl3MDMl4AQy+Gc76qk6X5 pBAAngWy4YSIgoqQ6TmcmQFFyd5CdDsBnuLsDd9znjrsKTYBBQWzCi57Vb2LUMl0mgIV 2Mrkih/mt5Wtz7FUl13n4b2+dv70/JBCAMQDUQLB5qjCMXecyt/offOSYLjuAEWv3Q9q m8T+QIDUptLa0Uc6W36j8G2kNnQ/ky0ujVlPwwJ71Pw6G2v/iHasY8QkeJl2+mOjBJ+i PncQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cobqrlVzLXF51JHnnbfvsbx22O5nYKpafcffHEFP0hw=; b=Gf+8vlnLVHlC4ZX2IxxzwcEEUefjPB/zaxExZj1ekPXHOUlM+iq4tyVhxdYF5nW8Gh Qu0gzoZrBGEHK0HxbB8ujYHOVp5kniH/ctBvUEXzBRWYGinlQ4npsqaI9nsQ20Vi8SIB e0PpeVvNaSKOxexgZvAJuwkEmvist7OgmCFpX53NfskUlaSioVlwNNH2kektY/c1Ms8U ATMR4/ERdiUUdRJ0M3LLL9OAsjB5AX8gv1fClKPAOuAL7zQpFuZG3SLp6UY5Hi9ugDne IC9589c8ILpL0wbDq29/9SAuWG5Mbp/gMwHBxDanpX5jQtNZMO7kMIaRqKQpfDdrA5I8 mPrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HzOX4XVU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x21si17910950pll.85.2019.05.20.08.28.51; Mon, 20 May 2019 08:29:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HzOX4XVU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388695AbfETMXv (ORCPT + 99 others); Mon, 20 May 2019 08:23:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:38410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388680AbfETMXr (ORCPT ); Mon, 20 May 2019 08:23:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C627621019; Mon, 20 May 2019 12:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355027; bh=cuCka6+D/zHu/Ia0WcLVoONDemKDc45zUEKXJ1Ae6fM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HzOX4XVUiVWTMKT2f+CSVqnGUgvBa2X+t7dQkKpbhcI0NFbqxiUoy14i5lLCX8tpM 3Olnjl38M0d8U1He1Dh+1eijLfYkJWIWRZCJ21jfJG9KwrCev+vZ+wrMiJQ+80CmCl glBRa44gJ0/s53tKefjmSZet/ASQAQS/OnC7ZdLk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Theodore Tso , Jan Kara , stable@kernel.org Subject: [PATCH 4.19 069/105] ext4: avoid drop reference to iloc.bh twice Date: Mon, 20 May 2019 14:14:15 +0200 Message-Id: <20190520115251.952565717@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pan Bian commit 8c380ab4b7b59c0c602743810be1b712514eaebc upstream. The reference to iloc.bh has been dropped in ext4_mark_iloc_dirty. However, the reference is dropped again if error occurs during ext4_handle_dirty_metadata, which may result in use-after-free bugs. Fixes: fb265c9cb49e("ext4: add ext4_sb_bread() to disambiguate ENOMEM cases") Signed-off-by: Pan Bian Signed-off-by: Theodore Ts'o Reviewed-by: Jan Kara Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/resize.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -874,6 +874,7 @@ static int add_new_gdb(handle_t *handle, err = ext4_handle_dirty_metadata(handle, NULL, gdb_bh); if (unlikely(err)) { ext4_std_error(sb, err); + iloc.bh = NULL; goto errout; } brelse(dind);