Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5982991ybc; Wed, 27 Nov 2019 12:52:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwBBpNoKB/U7EoA9243VRZzH6HsC7FAB1zLGfVcw8knY1r5F3ZdLJQKCVZpjC2zkYHG3E7s X-Received: by 2002:a17:906:5c0d:: with SMTP id e13mr49446243ejq.82.1574887968762; Wed, 27 Nov 2019 12:52:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574887968; cv=none; d=google.com; s=arc-20160816; b=zyqKalX24oap6ohYNfp5eavR2t7ACO87Xzs3Cyyiig8ur0fXlV61N6pvZ8YwbuXOA9 AdaqBIbBpIXZsCMFAKEHpd2nCnlqPlWWawJCI8MfMHpQYd0yaaPlKYXVYG7VKvTQ/Dcq OlvH64MdwUDo7ew7ES/UEYuJl/RaOZjOHuAMD0AS743ZIUtBHOPKEOqT8qiOkAhpxESZ hSTWaQStNoZac79nc3MnExV9/COhMGaXcPdjeY9t7MzXg7wnG/pDvsAmoZwWlVgA78Vt y2cX80ZpQIoJcIN+J/hGymPFStR0nqpccmA1usBsX4wanoWwt9y1uFzEtYKnAg5Ub5RR nq8w== 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=pWqjlwdIwF7padXrXV3mrPzABZ4WoZ4MvxHyolQ0cA6YE4VcR3t8iO/CGOQ20FEnSC PXlbmjnm8oZ7ZWIbOC7++vr3MfMGaugVkeLk5w/XgWu2JLGbwisfgxZgvxSGWqdZu3Rg /XdTEcjtF3zYp7Nox8JzHUH7iMXzz8QiU9H15cqShIO1lDPUBMYdawB4aOTC2LhHZRv/ D6+EkKwsj6aYs6Dga/9ckitcVtV8XYUfDciTeg1wzqEw2mocq2knVEn1HquBoM8BM3Oc LdZ97WtlqnpaVbWy89OXBTG1zC/Zl73YnLK56N/17QsKVQJSdutH6ydeyB8IelV06Y0B 21lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="iE/tFR85"; 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 n6si10053005ejk.160.2019.11.27.12.52.24; Wed, 27 Nov 2019 12:52:48 -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="iE/tFR85"; 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 S1730364AbfK0Uua (ORCPT + 99 others); Wed, 27 Nov 2019 15:50:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:36352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728335AbfK0Uu1 (ORCPT ); Wed, 27 Nov 2019 15:50:27 -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 6F9D42158A; Wed, 27 Nov 2019 20:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887825; bh=febHDCnmAbc7A9SiF0v4GbyjctYAv1LCzcdfJi+6TSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iE/tFR85UZkM512aBlAa/3Db6GFHKTyNN0NDAPElbAjbCynWBj3UaqsColgG+AvkB +9pW8K7TLhZhw/wN9IfsAP+42eeH9cd0mRQUY206+jkWtbQodDAICQ3g6zbshGglLe Peie0UIomu12QXaBLrWd474QS6H3LDn08rupZREE= 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.14 110/211] hfs: fix BUG on bnode parent update Date: Wed, 27 Nov 2019 21:30:43 +0100 Message-Id: <20191127203104.491510210@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203049.431810767@linuxfoundation.org> References: <20191127203049.431810767@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