Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6016410ybc; Wed, 27 Nov 2019 13:27:39 -0800 (PST) X-Google-Smtp-Source: APXvYqyT2KGCeJn16DUXTOsx/S0h+LcfFL+KG6I7VXw4B/1ddSxKu07nz01kiBj4g/Ld6cYeSRIO X-Received: by 2002:a17:906:d9c4:: with SMTP id qk4mr49820810ejb.214.1574890059276; Wed, 27 Nov 2019 13:27:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574890059; cv=none; d=google.com; s=arc-20160816; b=HC4tgrJUYcH+AEei4WTNkSwlWXB7jm+Tk02cnDUxYfBsvzd+cobdeoh8iH2N0kV4Lr lA9Pthdsrh71rbg/QDn+4sdTp6sN0p3cCjUxQvR/FIQC6o5FrgtPO8Ry1+i8eeEZ+qv0 atagaryB6huo4CM87zao+b0Iwp7YKIDZiO9puwi5ChOmO3rHAaoh5IIYhSw+7yba22Wm jd+AHQ4NIjvduTpvyd7Qu60zWRqrd1Abx/omE2C4nO+RA0EG3u/NLt6Fcqsv7rLTJrLP b78YFyLgKC+3USS4sm7Q5MGzGiSnElrhpSY+T5G/Pza3qRNEJ7mq6n9hwwzABt9ZKZ5K 4CMA== 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=qAPMVqg++y1hxaTjeuusSr51UCHydqPEho9H+5CAOuw=; b=sxX+9KT9FzZ7YbOCx7xKGVwgSsgsCIFfrfCB4SNqV4w+AJ/exfoXrPm5cOxxXEjNmj t3yGjzdRAyul3REJ+VlBpwdG3Pv95cRoJnuI2txSET6B3Ne7B8zixcTvYtb10PD0QNUO /Xs0suYV23dT4Hp8jswfHmAcR2O3NCci4x71JdocEEmjLb0EeeYfjwqI6BW4vfOcYN4a v9FIUECADHBVlSvGtNZtqwrjwehu/alRHwU3C1vbn60amXSjiapVDX5wxM3Oo5Lt1L+F 7QxPVWQ5du+dD0GW1DgNrZMpwdoJdv7mukLZfP9Aof1VHiQurD/ORadbQmT4PVy9fezC xk/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Sw7bxhN6; 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 pw18si3882139ejb.72.2019.11.27.13.27.15; Wed, 27 Nov 2019 13:27:39 -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=Sw7bxhN6; 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 S1731859AbfK0VCQ (ORCPT + 99 others); Wed, 27 Nov 2019 16:02:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:54740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731841AbfK0VCK (ORCPT ); Wed, 27 Nov 2019 16:02:10 -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 1C06B2086A; Wed, 27 Nov 2019 21:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888530; bh=pzDYauFJ0kQK/ZeJvv8P41sxlFTiAZXH6gXqzETieCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sw7bxhN6iJybLllwCXiy4KRN7FtIVPseDr7BslF19oUHmp9GEOc+1UWgFfKW6ePlL jNw5khgAypYOwHGWkRRejhqpSGRzVoXtJaQwwouAqUnqNWxyG4MMW8w8UMfCRw14jg x/Y4ZvKqKJnQIxlWvyl7/7gZeCJCpeHT15PGKL6U= 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?=" , Christoph Hellwig , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.19 170/306] hfsplus: fix BUG on bnode parent update Date: Wed, 27 Nov 2019 21:30:20 +0100 Message-Id: <20191127203127.828855342@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 19a9d0f1acf75e8be8cfba19c1a34e941846fa2b ] Creating, renaming or deleting a file 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. This bug is triggered by xfstests generic/027, somewhat rarely; here is a more reliable reproducer: truncate -s 50M fs.iso mkfs.hfsplus fs.iso mount fs.iso /mnt i=1000 while [ $i -le 2400 ]; do touch /mnt/$i &>/dev/null ((++i)) done i=2400 while [ $i -ge 1000 ]; do mv /mnt/$i /mnt/$(perl -e "print $i x61") &>/dev/null ((--i)) done The issue is that a newly created bnode is being put twice. Reset new_node to NULL in hfs_brec_update_parent() before reaching goto again. Link: http://lkml.kernel.org/r/5ee1db09b60373a15890f6a7c835d00e76bf601d.1535682461.git.ernesto.mnd.fernandez@gmail.com Signed-off-by: Ernesto A. Fernández Cc: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/hfsplus/brec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c index aa17a392b4140..1918544a78716 100644 --- a/fs/hfsplus/brec.c +++ b/fs/hfsplus/brec.c @@ -449,6 +449,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