Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5992755ybc; Wed, 27 Nov 2019 13:03:46 -0800 (PST) X-Google-Smtp-Source: APXvYqz/ud8J//SRj4/zBCO09CM+pjvS/YiJ6EyCEHaeir1sa0TIk8wmbpSiEl/X8U5PYmhYcLzn X-Received: by 2002:a17:906:f245:: with SMTP id gy5mr7680305ejb.225.1574888626540; Wed, 27 Nov 2019 13:03:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888626; cv=none; d=google.com; s=arc-20160816; b=GS5MfBoTYc+g0SstwijNq7KgO2p+wwdZxwB0n0TGhyPzrzP45GVMYDh73WeXAbHlkk 06wjP6d4lJr4wryyDj45Ubffkixzoddnrzo37VDY4jzUtG7r3WDUaLT9SLQI/3a6Pasf rny/W9Qw9bE2PU2kaeaIMY3ObnrUGYzhxi20xwBUI4NMZQVK+yXka6Y9IpFvOS0Q5/RF YHkCP/qVCZPXjKa9loPDANAcKJWy9Ob/+N5+OUO7OzUMCXlP/NDQQcth/uggztZ3lHR2 uHO+iWYZ7uUyQDwP3yWohI8r5x+9dcHZ/1iDlyI5t2P6Tt1Wx8FRy3htXAVDYKb8NuTj 6GpA== 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=Pq0UpLo5zs7yGonQ6OY4OYtJZqL5qMQ+z6ec+324RKI=; b=WDoXp/109Wzs2WG8GRC5aZQ84QI4S22F5JY8eda13O4wu4XHlYI8fq4hO9h/BOFuRx UKVkeDlraUWxp3/ly7TQd5R2/ZkpB++B0sYlRLIfZczW/IEGE6QZ7aKxZw9dJSkIWUW2 y/NixgUvMpGO2wfdj8R0OUOsyetaHQh0IFSk34aSZ6r2H8M+/emCqgG2SS1UPJ5bQHl6 DvnZZZ7A98keRRc9JV8m6YK+Rm9+NJeIRVL72rzabgDIrhariX2eyfcsw+vmg704ecW0 PR3QyABhP3hXzV7lwslKE0PSneDXH05T2N49jKo+4LC3CttAqPACSnXNqr7pOK9KeKTL tHXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ews0gNjW; 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 a14si11758604edm.344.2019.11.27.13.03.16; Wed, 27 Nov 2019 13:03: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=ews0gNjW; 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 S1731867AbfK0VCR (ORCPT + 99 others); Wed, 27 Nov 2019 16:02:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:54774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731031AbfK0VCO (ORCPT ); Wed, 27 Nov 2019 16:02:14 -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 9A90B21569; Wed, 27 Nov 2019 21:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888533; bh=febHDCnmAbc7A9SiF0v4GbyjctYAv1LCzcdfJi+6TSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ews0gNjW3Bj5dTdssvdhPSugT8r5SuamdysJFKt0MeBHUceLDawfb11l9YjnmGtuu w3AeRXp8k5heJZlFN4FgGX88xxXqnGsH9h7PG693aAqvNflRcGy+xwc+xhyls3fjUL uOoEh5eCEJkHL0CPL42MBBv80b7AuGqryZTKLKV8= 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.19 171/306] hfs: fix BUG on bnode parent update Date: Wed, 27 Nov 2019 21:30:21 +0100 Message-Id: <20191127203127.890727526@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@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 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