Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6029589ybc; Wed, 27 Nov 2019 13:42:10 -0800 (PST) X-Google-Smtp-Source: APXvYqzsebv190NrtEakUJLiVmmiwjS44RAEQooykcFS0YVjiBH//Ib/fmb8om2fK3HccECIKSXb X-Received: by 2002:a17:906:bce5:: with SMTP id op5mr51900677ejb.325.1574890930275; Wed, 27 Nov 2019 13:42:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574890930; cv=none; d=google.com; s=arc-20160816; b=JLw/sxGP3CWkNC8dWGmGywLuglF70+s95mxAnmhgfSRVJMBZwTr8zf0FvwEAq/41gO kGNKVnTv4g4YQQMZqsfy2lApKdOUQv6FneJhWcUUOVQ6YuDXhlDz3fTCmXXY7a0PKCzq AkFFshKrtQl1qRS4bePsH/p42wesC4UKj44y+oLsPaZsCvxBe/YlR0LioxEoxOMM0RQQ 6+xd4RET5tal2zJE046MxRWQpA1ikqxEW49ghmbfhQkCqx4sYU96LoOWLlRG2XDLpH5t zIzllr3OGinsV48N8jYKKc6nvAAdd45zjfAVZqmbrQUP5MaSmsiTdmDBaY46Dchhd1r2 7Svw== 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=07odPJHylup2xCj/z/CCLgK8SQz5Ks9oTJYJ9Svtd54=; b=0FOtorJGi2G8/ghS019DEG265KwZK2Zojmy45wc8GRRGL0TBa8vROxz/m66TnYclQ9 dKYoT0XYCB5UN8InKrOUS6MsjhQTD6hEU9JSy5QTAdsm3+9kLOsIfmG8zO8oYeoCThA6 wU5wNncgj5DWH4jMuq+QSEXH2BB2yhbtnEV1VwHsPocW0vSN+afKPSgbSbss2TEUmWiP HVGw7W0ziP3FfKnBXl3IKql9uFUnQh6WZ+ynyYU0NAV3pw9W+tkBtcpCmxJUCvSUS7ry AeF1UmkZ0RzUcHapMd6Lh+fwv5OcawgvRslgafnAsFl2NtgFSMpH0n3rvIXJs4KlyHlQ 29xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OJ92rlks; 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 f19si4733981edq.319.2019.11.27.13.41.47; Wed, 27 Nov 2019 13:42:10 -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=OJ92rlks; 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 S1729514AbfK0Vjd (ORCPT + 99 others); Wed, 27 Nov 2019 16:39:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:52888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729532AbfK0UoG (ORCPT ); Wed, 27 Nov 2019 15:44:06 -0500 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 B6662217AB; Wed, 27 Nov 2019 20:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887446; bh=XGeaBPaoTRyL12hk8l8n/RDBwwRN4upaOnS/zIqnn14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OJ92rlksXB5Is6pbIVrWPfSZmxhnJjWl2f5Seb8w2IpxsG1vXF/VOVSmXkN9gTprh YR8J1TwuDV6uIeHkPVmBJfCR3ocOqLtiODEWfAnEmcRaIlalfd65c5HulFCUPaCGyT jIs1SNUx4Y0R923G82KUfMgJZpFQnLoI6T/qf6xg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "=?UTF-8?q?Ernesto=20A . =20Fern=C3=A1ndez?=" , Andrew Morton , Christoph Hellwig , Viacheslav Dubeyko , Linus Torvalds , Sasha Levin Subject: [PATCH 4.9 072/151] hfs: fix BUG on bnode parent update Date: Wed, 27 Nov 2019 21:30:55 +0100 Message-Id: <20191127203034.728700754@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203000.773542911@linuxfoundation.org> References: <20191127203000.773542911@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: 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 2e713673df42f..85dab71bee74f 100644 --- a/fs/hfs/brec.c +++ b/fs/hfs/brec.c @@ -444,6 +444,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