From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796383963; b=yPH4IVDpVjSEiwpKzeXazI4JvOl5PM5VR/0M/D7Ffu8hqEGYKKUZz2zMJXgzn2XO/n40 wY6undOjcmn2OqMzZqAM/HfYb5qybi0e58trRHUZu/Hrm1urtdBMLp7lBmThDYj8GlNvw YJA0GW50zh2XnJ5DTaH2yP/TG/qF2ooCwy03cFeSuHsdTCAJgmgSJHri+QI4Y1Zgg5PpU 1q92y3/2Gr9PI5kWC3ovNR9krmZKLGDTfeMtVgtGnWCqCH2FtFIO4WGc+J9Iq4R1VzcOz hLEZd9dTs8mnv3i4JgvmH7BM63Prdm8cpIxN1HNdcwdG66PuiZA+tRfjhaafeokmINg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383963; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=lrXOcBfsGcPTQ7o/CmWRwUlvQMBBcQReWn3JcDknh/s=; b=A2l7mqKDg1eQ1lnwf5a5vx1UFiaxTfiY6LDuymceQKfC70TAwsLeZfOzk4lSw6f8g7eO 9REz62ciHmtkEqNpc3OI1bR/YwUyAGh9SXvVhcJdAtM3CKpb1RtfHUQFfAl3tE2mQvPMP uVCQL1oXMOO5ZA0QV1qj9B+DZzl3S1HD9WWYCv5DAc8+e1DDoV2IwuZSYWC9DyMRT+SBf NOH9LNkQwAAXZXFmwh4+jCWSyykypxavGocjf0lND4J4XE0ZXGRS1c3TEfvJs8ch1jOHO WScbdgeF15sYpwrMHIIfbLaS4NDSLAQmBrsjdt0g3kT+MK3MbOPSAlxkwGB/MmOQbPw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Ig+EAvD4; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE816606A332; Fri, 4 Dec 2026 11:32:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Ig+EAvD4 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D68731F000C2; Fri, 4 Dec 2026 11:32:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383963; bh=lrXOcBfsGcPTQ7o/CmWRwUlvQMBBcQReWn3JcDknh/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ig+EAvD494dRHR3ryWs0SpR6OZtDg4jyL+OlQEwSZv3zsUuJ22M1eu3GKucnwzVnU PHMsjitHEoVhsHeOYUqXW52K3rnVT2D/veXZowXKGp+PZiByK+fisy5JCBcJ+lqYXm juHwzerP6EomIx4N6GYJbr83gtPq7ZsdOQOcuztw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexander Gordeev , Jiale Yao , Heiko Carstens Subject: [PATCH 6.12 439/555] s390/dcssblk: Initialize device semaphore before sysfs registration Date: Fri, 4 Dec 2026 19:08:02 +0900 Message-ID: <20261204100626.272600364@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiale Yao commit 64ee7f863655e67f26947420516daba4e232675d upstream. device_create_file() makes the add and remove attributes writable before the device list semaphore is initialized. A sysfs write racing module initialization can therefore acquire an uninitialized rwsem. Initialize the semaphore before registering the root device and its attributes. [hca@linux.ibm.com: Use DECLARE_RWSEM() instead of moving init_rwsem()] Cc: stable@vger.kernel.org Acked-by: Alexander Gordeev Signed-off-by: Jiale Yao Signed-off-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Greg Kroah-Hartman --- drivers/s390/block/dcssblk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -101,7 +101,7 @@ static DEVICE_ATTR(remove, S_IWUSR, NULL static struct device *dcssblk_root_dev; static LIST_HEAD(dcssblk_devices); -static struct rw_semaphore dcssblk_devices_sem; +static DECLARE_RWSEM(dcssblk_devices_sem); /* * release function for segment device. @@ -1008,7 +1008,6 @@ dcssblk_init(void) if (rc < 0) goto out_root; dcssblk_major = rc; - init_rwsem(&dcssblk_devices_sem); dcssblk_check_params(); return 0;