Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3445955imj; Tue, 19 Feb 2019 03:44:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IZelJ+K7h2H983A+9eKjYKyMvHRU+9BX8z122scBr0HMJ2yqcq9LAYJsO4bZSafQixxlziS X-Received: by 2002:a17:902:700c:: with SMTP id y12mr16020282plk.71.1550576682781; Tue, 19 Feb 2019 03:44:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550576682; cv=none; d=google.com; s=arc-20160816; b=Hbo7WzcRx2eY2WtF9Tr7yC0q4LfsSONZA5pIf0tpZl1PD3dk9bBixdHNzfXUHn++1+ cHsGGBWCw0CL8iIvpPmSD70krQ/G3X7YDPLko75MQK1A1UXLG0B31rjzzXdhh8Nwswk8 ErW/+WnS6OY8Orn3Mfg/ombeTc5mc5aUmz4/zg/pK50qVZwl0tWHhkvupSohuPe56pbB NNRdhYMCpcC6QNPUiguPpiVHhbogMp9H3YC2ZK8q69Wne3TtPmVxKaoPNiaeeU3W7w0Q FNURTx54QlU0zSRtomdAF2pwE6Z41buTotSIYsew8oOYHtIdcCcajkFXNx1E1s+n09vz YmBA== 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 :message-id:date:subject:cc:to:from; bh=N+01hzZpwSRIA5ZjjDxaEs7XZtPppoFktDD7Gxst5sA=; b=mEK0l6aV8WQ/bTL+gyn3xV358EEmzV8CRvn1NbxjtZePQCc6+RTEtGb63nxMV6ZIZT fLEL31aEJkXjYH+XsYZSTLE43Jl013CniQRxOseIr8JXLcDL0SG+B4QL5ARdi0FvYTFS cccvV8ldUfMWveMutCKZXzYQ+JgKi0qx8i1nOwyc6r3Pk33RLEROOeqs+RRJXE1ooSxA tgiozab5XYPE2YbfBV4rtk4evXhWrtkk+kIz2Noi7B79kY0QYG4QFAwIRtN3SwVX4+k4 L5wLAA3uY7GEwvOBn5mBjbdD+KPmikil22Z3dcfya54/dsmJcF5c8JubMeZcgV9UQNHg JQHw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e65si5412386pfa.80.2019.02.19.03.44.27; Tue, 19 Feb 2019 03:44:42 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727048AbfBSLoG (ORCPT + 99 others); Tue, 19 Feb 2019 06:44:06 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:51833 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbfBSLoG (ORCPT ); Tue, 19 Feb 2019 06:44:06 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1gw3oi-0005mr-Bw; Tue, 19 Feb 2019 11:44:04 +0000 From: Colin King To: Jan Kara Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][udf-next] udf: don't call mark_buffer_dirty on a null bh pointer Date: Tue, 19 Feb 2019 11:44:03 +0000 Message-Id: <20190219114403.24771-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 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: Colin Ian King There is a null check on the pointer bh to avoid a null pointer dereference on bh->b_data however later bh is passed to mark_buffer_dirty that can also cause a null pointer dereference on bh. Avoid this potential null pointer dereference by moving the call to mark_buffer_dirty inside the null checked block. Fixes: e8b4274735e4 ("udf: finalize integrity descriptor before writeback") Signed-off-by: Colin Ian King --- fs/udf/super.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/udf/super.c b/fs/udf/super.c index a6940d90bedd..b7e9a83d39db 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -2336,13 +2336,13 @@ static int udf_sync_fs(struct super_block *sb, int wait) lvid = (struct logicalVolIntegrityDesc *)bh->b_data; udf_finalize_lvid(lvid); - } - /* - * Blockdevice will be synced later so we don't have to submit - * the buffer for IO - */ - mark_buffer_dirty(bh); + /* + * Blockdevice will be synced later so we don't have + * to submit the buffer for IO + */ + mark_buffer_dirty(bh); + } sbi->s_lvid_dirty = 0; } mutex_unlock(&sbi->s_alloc_mutex); -- 2.20.1