From patchwork Mon Jul 1 14:25:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Adam Davis X-Patchwork-Id: 1954736 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=qq.com header.i=@qq.com header.a=rsa-sha256 header.s=s201512 header.b=woHIJPTO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=mail.ozlabs.org; envelope-from=srs0=rrxw=ob=vger.kernel.org=linux-ext4+bounces-3059-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WCT5z5KKXz1xpN for ; Tue, 2 Jul 2024 00:32:39 +1000 (AEST) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4WCT5y29Gnz4xGl for ; Tue, 2 Jul 2024 00:32:38 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4WCT5y25tGz4xM5; Tue, 2 Jul 2024 00:32:38 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: gandalf.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=qq.com header.i=@qq.com header.a=rsa-sha256 header.s=s201512 header.b=woHIJPTO; dkim-atps=neutral Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-ext4+bounces-3059-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4WCT5v5FcHz4xGl for ; Tue, 2 Jul 2024 00:32:35 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 23E451F273B0 for ; Mon, 1 Jul 2024 14:32:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E18481684AA; Mon, 1 Jul 2024 14:31:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="woHIJPTO" X-Original-To: linux-ext4@vger.kernel.org Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 744A716849D; Mon, 1 Jul 2024 14:31:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.62.57.252 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719844281; cv=none; b=oCe0WP1zLr9Dj7k+S+rnX2GiLrYRDUaVhFo5b0PYaanu173OljWeRv6vRAnUhMHXpRp82x94LrAeBul+lrcw1zLo+0VpxJzT2sTokMwnbSoiEylc7HPG9JQujhaK36BsDGQ5LDNMHp+wsvE/+CbBooVKnmmgmZ7h6t7h0JBcza0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719844281; c=relaxed/simple; bh=kh4fd2Tt1g3FgPpUUT16nQDDaDmCFVlh5X1PX3Rz9RU=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=nSCws6SAKRbZx8u+4a6m8Q0VDt1IJh9wcnKtyxzVGBjCQE5WAS0aSUrNOtlNSVP0unCSEJFo3pabTESGKW1Uw5c1Iyk4FZ2T/wCKRN9rmoB/hmeHLNQ7sIOjs/dDKw7eGZyhjT/3NkSwWQJwcSa8RyuPeB8Xa1DWFQXw0WAmvFU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com; spf=pass smtp.mailfrom=qq.com; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=woHIJPTO; arc=none smtp.client-ip=162.62.57.252 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qq.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1719844268; bh=oig2jSCI3rDtVcLntOJD59bkVH+SVdUKsJBtU3A9NPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=woHIJPTO5DRjvijRxgqfRyyE6eNzJxy3y5aP5Fq2WJDs17gcUF3EkUWLr6UfD+BJs jYs1z2gUcsNn0Gg/VMSRcoaimdNjweUaY/pUXgR4Zdc+ZoPuZAgNCkTDUECSlGnNrf 1jNT3EwsY8sjT8OcMjOHJYgJZAP9CcXj4YxTiRZY= Received: from pek-lxu-l1.wrs.com ([111.198.228.103]) by newxmesmtplogicsvrsza10-0.qq.com (NewEsmtp) with SMTP id 642386CC; Mon, 01 Jul 2024 22:25:02 +0800 X-QQ-mid: xm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688d469e36fb5138d0@syzkaller.appspotmail.com Cc: adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, tytso@mit.edu Subject: [PATCH] ext4: No need to continue when the number of entries is 1 Date: Mon, 1 Jul 2024 22:25:03 +0800 X-OQ-MSGID: <20240701142502.2973881-2-eadavis@qq.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <00000000000075a135061c0480d0@google.com> References: <00000000000075a135061c0480d0@google.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When the number of entries mapped is 1, there is no need to split it. Fixes: ac27a0ec112a ("[PATCH] ext4: initial copy of files from ext3") Reported-by: syzbot+ae688d469e36fb5138d0@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=ae688d469e36fb5138d0 Signed-off-by: Edward Adam Davis --- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index a630b27a4cc6..0a111274dc4a 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -2043,7 +2043,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir, split = count/2; hash2 = map[split].hash; - continued = hash2 == map[split - 1].hash; + continued = split > 0 ? hash2 == map[split - 1].hash : 0; dxtrace(printk(KERN_INFO "Split block %lu at %x, %i/%i\n", (unsigned long)dx_get_block(frame->at), hash2, split, count-split));