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=1796389512; b=CXFfl2QOmzfNBUa3i6pCQue42FdS2Hi9uBMmUKT7z82kZBKgoNHc4ELOaDcLR8LwZIim CRArjMWitM+0vlQv4F1EoKZJRibJpWatq3dCQyNBuGqfK0yYsv/sfSGYoMeo782ZM3/b5 8bL+4CJtC6fExxqiqtCS3JkJZ5dzIwZymgjnDbxZ7JMGCidMpCbauLpZm5QSGl6RWFpeo ma1QOCdqEyHe1jnzBIkSTbyI9IaCONjtNJYIhFzQ786UzS1Q021WeRoUK5MB1R3oMCATq ynTLXX9Y0b6cDCMr6Hy9Zgi1wFK7lneSnYKXg8qnzGwVRST96HhdyifmTrL5skffrrg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389512; 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=ZKIJZFmvIQY9WGqFgPHKF+AREaKgSyvTHc1cwkSelzU=; b=mx3pud9jURu2YRmy5YMf3CTAWCNE2YftP8Kjr6FSsOdV7PWSj3DvfM7VDbUyRTzmzoG4 VpK0U6BB3trCI1ZwXc5GuMk7bNm+IxPSYxDJLYJ6uI04U7VSm2WD8R27kjELkyZNzLPSK vlhFJ1HcQj98dCK96DTcD/QlhqfZfrVV7mXe1gOH07dcyFiXItIA3IKxGPt4M767X9ICx LG/UOA0mfzvGEydOu5BSO5wmywKIRXTQDQQ1bMxQvcZUGS8jMhpxFozAMSfTG9mH+1uPS ColiXJuTrMn/hAh3IFKlKh5p4Pf78I5Mtr80JdkOMgFsEf6RcvGf6D5BnAXPdtTcliw== 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="r/Judzhr"; 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 340CE606A322; Fri, 4 Dec 2026 13:05:12 +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=r/Judzhr Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75EE51F000C2; Fri, 4 Dec 2026 13:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389511; bh=ZKIJZFmvIQY9WGqFgPHKF+AREaKgSyvTHc1cwkSelzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=r/Judzhrtu4WE4z+2OHop2OOsS8hB4C1u6dWjk8JnPvZ2GDd4OgSGJ/W2rUiiXy2/ Sht3hDNu7pfaweVDd/vcWdB2d+pbRqUo2XkQ69tmgUJLhyPNP4bISOWZ2Di1N+33jm 13HTqo54RbhpEyfkoGBqQexT4jaeCyihV8j9YfXA= 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.1 0979/1059] s390/dcssblk: Initialize device semaphore before sysfs registration Date: Fri, 4 Dec 2026 19:08:30 +0900 Message-ID: <20261204100709.365063429@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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 @@ -100,7 +100,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. @@ -1012,7 +1012,6 @@ dcssblk_init(void) if (rc < 0) goto out_root; dcssblk_major = rc; - init_rwsem(&dcssblk_devices_sem); dcssblk_check_params(); return 0;