Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 04DF337F8B1; Sat, 12 Sep 2026 08:58:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789203532; cv=none; b=O7pxGIMD75W3xms+kVMJCx/ufKq5IOcjlr1505W59ENx0DUJ5CmnjX88Txlk4XhNhWTIttIR98cbaTUzZ6o85UlMkBZLxOB6YfRW/EPJ28XukFY49m5jbMLIH4cKtVP9t1m5XLPYWACI/6ZsCXeuRu8SOmQuO1qXjfKqbAnWhuA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789203532; c=relaxed/simple; bh=W3zkpBWfwiMJfEpygXYXETXwl3hQNqJpIYkk0CttuYg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZttB0Kv4zfONzwJ+IgGtbkUjrW+qUxMRMDJU+g3XeQciY9HU/BBh1ZF/vzxyLQzsaMUWfZnqr0IvXsfWBa8v5MZ2MhejbVz3+nTozwqztHLxajPBT7ksJMzVmiEt1A4tfOqiNKXvCShRDpkNU6JE6SPJ9OKwom0vnIOvuEdocMs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1uvyVg4c; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1uvyVg4c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFFED1F000FF; Sat, 12 Sep 2026 08:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789203530; bh=fZHkxv0E+YshE2V36Sbe1KvQEPw616yyzEbmyCDzbIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1uvyVg4c2vP51xifyFWxMEqf6QCM+CAMRjRh/gTPM0Y9tqJHh8INXuz5bdzZtBBLQ 3ORJOeYslT+dtcQvpYgy+rfmdH6DBl3Pq4q0inbsyX9NolsPOZD5GYdyf0QClYoogi CgAi3WI7sGBWc7K9TwOXsbUpmVL/UHjPcl6CtpNI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Sasha Levin Subject: [PATCH 7.2 1428/1815] s390/debug: Fix deadlock during unregister Date: Sat, 12 Sep 2026 08:52:58 +0200 Message-ID: <20260912065722.542722384@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065648.999753832@linuxfoundation.org> References: <20260912065648.999753832@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Oberparleiter [ Upstream commit 445c31ac638fd1af203d79bdf25fc0cb3149fbbc ] Unregistering an s390dbf debug area while one of the associated debugfs files is being written to can cause a deadlock: $ echo >.../vmur/level $ rmmod vmur =================================================== debugfs write debugfs_file_get() debug_unregister() mutex_lock(debug_mutex) debugfs_remove() wait for debugfs_file_put() debug_file_ops.write() debug_input() mutex_lock(debug_mutex) ==> DEADLOCK Fix this by splitting debug_unregister() into an s390dbf and debugfs part, and running only the s390dbf part with debug_mutex locked. Fixes: 9372a82892c2 ("s390/debug: fix debug area life cycle") Signed-off-by: Peter Oberparleiter Reviewed-by: Heiko Carstens Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin --- arch/s390/kernel/debug.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c index dbf430f479bdf..14d2b58ad0930 100644 --- a/arch/s390/kernel/debug.c +++ b/arch/s390/kernel/debug.c @@ -993,8 +993,8 @@ void debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas) mutex_unlock(&debug_mutex); } -/* Remove debugfs entries and remove from internal list. */ -static void _debug_unregister(debug_info_t *id) +/* Remove debugfs entries. */ +static void _debug_unregister_debugfs(debug_info_t *id) { int i; @@ -1004,6 +1004,11 @@ static void _debug_unregister(debug_info_t *id) debugfs_remove(id->debugfs_entries[i]); } debugfs_remove(id->debugfs_root_entry); +} + +/* Remove from internal list. */ +static void _debug_unregister(debug_info_t *id) +{ if (id == debug_area_first) debug_area_first = id->next; if (id == debug_area_last) @@ -1029,6 +1034,7 @@ void debug_unregister(debug_info_t *id) mutex_lock(&debug_mutex); _debug_unregister(id); mutex_unlock(&debug_mutex); + _debug_unregister_debugfs(id); debug_info_put(id); } -- 2.53.0