Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp735375ybc; Sat, 16 Nov 2019 07:47:46 -0800 (PST) X-Google-Smtp-Source: APXvYqyCXnavbF3lPaWAQ2TrgQzKHgnzHxMb9v3CTV0n8h8UCk3vDiqdq2n5R2s6fyok0kY9g1xh X-Received: by 2002:a17:906:1d19:: with SMTP id n25mr10378630ejh.151.1573919266560; Sat, 16 Nov 2019 07:47:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573919266; cv=none; d=google.com; s=arc-20160816; b=NpdxBBaGV1+59A1Z6pV6HiyfeVxrj8ZrAG0fI4yDk4T1WeT9CTHv4+Ht0ZT/KCCG4+ wAPw9xtkBADyXl3t+t0cXw0cnO4HkqQlx9pdQBXu1Le43f+vG+HwYUYTfjlrTE7GO/2T rbXDsllS9B6wDqk8waaJrUuwrJKb+TqNOXz5+5NmxFr+zFs6VHqYuiWzS72lsFUam0n9 mVCP1Dcm+r0gagsLrLlgzVqNb3J1po6kzMSycJKOGdSuPMNywbHDGbaYiH4gIfSdKI+k hnGB2HXMK8b+9ap1bj3r0Zur6bVBBuUUgitXUvdYggCIwlkxYzBNJnfe+JFT5hcrM42T IUrg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Pq0UpLo5zs7yGonQ6OY4OYtJZqL5qMQ+z6ec+324RKI=; b=hk2bLMbvVOxSqy/PSJUqo+tpwfpAkaev5pH0LyC5c+G0nDF0UpigsVN0CYiHFCkXe3 zyTcnanKsYLi3fOPiS8E0lsD7aGiX2Cq3LUHwS92T/j4N+KwzesY3UYIpLPFbeIgcu43 2iLacAPgoyZ0esTyCv1u+c8pzqTNTA6gTPQjzBsknlDT/pUDZsXr4/1KJ7YY0i07xpww RgPM+nNIUgzBg7Z5MI9dQuOhvCxh6Ttbh0abg8au4KHsTtl8eO0xq3HyJtyZ4Tnqz8iM S6sJXkCfb1KOwJuN/oXaXb1FLs3wxw3ZhREZzw8q/h0nK347QsFAgcfzWw8i+SNKuPzd DxYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=K0jTWBYq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u18si3429558ejj.343.2019.11.16.07.47.22; Sat, 16 Nov 2019 07:47:46 -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; dkim=pass header.i=@kernel.org header.s=default header.b=K0jTWBYq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728245AbfKPPpJ (ORCPT + 99 others); Sat, 16 Nov 2019 10:45:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:50226 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729110AbfKPPpB (ORCPT ); Sat, 16 Nov 2019 10:45:01 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4255D20740; Sat, 16 Nov 2019 15:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573919100; bh=febHDCnmAbc7A9SiF0v4GbyjctYAv1LCzcdfJi+6TSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K0jTWBYqtbSiLfEcAsS52g7VjAPgQm0wvDKJWOgMeCa8xR64/KvHIU7lDMIPfMfJM 7/sxc7Dm8sYMFEe8wvVm89jzCyfmVXFXWIKUDArlGSaI5GIN4SIjjhsNOo2ldiTZ9l GoiB8lah/xESWMu+hM3K1XNjwoTTGwIY62MqA+Jw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Ernesto=20A=2E=20Fern=C3=A1ndez?= , Andrew Morton , Christoph Hellwig , Viacheslav Dubeyko , Linus Torvalds , Sasha Levin , linux-fsdevel@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 154/237] hfs: fix BUG on bnode parent update Date: Sat, 16 Nov 2019 10:39:49 -0500 Message-Id: <20191116154113.7417-154-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ernesto A. Fernández [ Upstream commit ef75bcc5763d130451a99825f247d301088b790b ] hfs_brec_update_parent() may hit BUG_ON() if the first record of both a leaf node and its parent are changed, and if this forces the parent to be split. It is not possible for this to happen on a valid hfs filesystem because the index nodes have fixed length keys. For reasons I ignore, the hfs module does have support for a number of hfsplus features. A corrupt btree header may report variable length keys and trigger this BUG, so it's better to fix it. Link: http://lkml.kernel.org/r/cf9b02d57f806217a2b1bf5db8c3e39730d8f603.1535682463.git.ernesto.mnd.fernandez@gmail.com Signed-off-by: Ernesto A. Fernández Reviewed-by: Andrew Morton Cc: Christoph Hellwig Cc: Viacheslav Dubeyko Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/hfs/brec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c index da25c49203cc5..896396554bcc1 100644 --- a/fs/hfs/brec.c +++ b/fs/hfs/brec.c @@ -445,6 +445,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) /* restore search_key */ hfs_bnode_read_key(node, fd->search_key, 14); } + new_node = NULL; } if (!rec && node->parent) -- 2.20.1