From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D18C724DFF9; Mon, 1 Dec 2025 11:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764588566; cv=none; b=uSwj01WaRsAlEsL0cBhR9bhkqlO3nJ4kWwQ7ufKsuxMD/gfgV+x0rAgx7n2lbA67gNTSzkFEV85k0GLdYi1aYXbhDoN1LYyZJbUt/CEpElzbf1HglJzNdrNg+rljjJQ6+Q9CQuHpeh3y4UNdigIl/BQxBZgwGV4AG1hW5iC0hqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764588566; c=relaxed/simple; bh=9v5LbQCIhblWsN+q5g3LBEQuQNUNfDlU7q4wM8XR4EM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YAViZenmiGnnS7KdRHHftr/ps82XMUm5WxhiACT21kRwsDyDI6i9zuzTgbIMXzM5Kb4WJbl5FgK+ZP6Lh6di6/5pIAgQuZF+f6JpDm4PRAca9vc1AqUZtLDdLUL/hHCTcX/8L836/Ko4d7C38aW9n4vIys/DhMpHV2J9KTND6Ik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oE5Ke+Yx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="oE5Ke+Yx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55BB3C4CEF1; Mon, 1 Dec 2025 11:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764588566; bh=9v5LbQCIhblWsN+q5g3LBEQuQNUNfDlU7q4wM8XR4EM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oE5Ke+YxPKimVqWnKL+nct2tJHGHB+ppro8JtGDx1LIKp1QMhwh5dubSOXU48yrX1 vqpQ1+k/Z3V3umMwsSHqnWXzj6qrsTVjMy17IfVZkWRzSI7ji4RwbsAg4qHDo0QO8r 4NiRodM4xDpLTYFUWYVi7I35s7voAUhgBnR2CpY4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+c4f3462d8b2ad7977bea@syzkaller.appspotmail.com, Shaurya Rane , Dave Kleikamp , Sasha Levin Subject: [PATCH 5.4 094/187] jfs: fix uninitialized waitqueue in transaction manager Date: Mon, 1 Dec 2025 12:23:22 +0100 Message-ID: <20251201112244.638235384@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201112241.242614045@linuxfoundation.org> References: <20251201112241.242614045@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shaurya Rane [ Upstream commit 300b072df72694ea330c4c673c035253e07827b8 ] The transaction manager initialization in txInit() was not properly initializing TxBlock[0].waitor waitqueue, causing a crash when txEnd(0) is called on read-only filesystems. When a filesystem is mounted read-only, txBegin() returns tid=0 to indicate no transaction. However, txEnd(0) still gets called and tries to access TxBlock[0].waitor via tid_to_tblock(0), but this waitqueue was never initialized because the initialization loop started at index 1 instead of 0. This causes a 'non-static key' lockdep warning and system crash: INFO: trying to register non-static key in txEnd Fix by ensuring all transaction blocks including TxBlock[0] have their waitqueues properly initialized during txInit(). Reported-by: syzbot+c4f3462d8b2ad7977bea@syzkaller.appspotmail.com Signed-off-by: Shaurya Rane Signed-off-by: Dave Kleikamp Signed-off-by: Sasha Levin --- fs/jfs/jfs_txnmgr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index 6f6a5b9203d3f..97a2eb0f0b75d 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c @@ -272,14 +272,15 @@ int txInit(void) if (TxBlock == NULL) return -ENOMEM; - for (k = 1; k < nTxBlock - 1; k++) { - TxBlock[k].next = k + 1; + for (k = 0; k < nTxBlock; k++) { init_waitqueue_head(&TxBlock[k].gcwait); init_waitqueue_head(&TxBlock[k].waitor); } + + for (k = 1; k < nTxBlock - 1; k++) { + TxBlock[k].next = k + 1; + } TxBlock[k].next = 0; - init_waitqueue_head(&TxBlock[k].gcwait); - init_waitqueue_head(&TxBlock[k].waitor); TxAnchor.freetid = 1; init_waitqueue_head(&TxAnchor.freewait); -- 2.51.0