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=1796382581; b=N95cLl+QC8fvoun7nf29Ogzl+jP61JrXHBw6kS3Texwihej/zkNyMmmMY9HQMVF+VjIq 4fVRNDmNLRfnUpKwVE2jO1KTdhNBJxTv2mbIK9xm4zpQZthP59CW7JFiuvqqcmqvA26PE p+mWO0KKIdeOJQsTcjpAqB34TX29c2gBG0FdkAzlCcpvo2pn/p9pMJC18C7wkoIWHx8pq MPnoo7HHFTE0h0ifQcwA8Lq+4ziwseXP6cUACUN73UiwRHdMTAE6LQ4fxIqEDnepFojH1 AjyWa90DhcfcLlJ+qg7UAJSSaAj7xvgH538468xRpmiOxnV8U96xEXb+si4+VR3M2Wg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382581; 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=Zfil/ipYETqKmtXhx3Y6RMMkbUkQw/QYiRfeWgrTvr4=; b=kqUwnsjHp+u5VHOXXxXF2vqhJx2+Gh7Dsf+Zqj+3ojNAJk8pqpyzclo44m+VmBOoA5/6 JW0GSUTUtPrlPrc3PK4v34xAvSv2rHeQ7y7zlVMnjpoiOQM9oYo50Ew0ywfBHBr4miHUS 6Tw7reyKNwf/qcxHQ6EgjDfpKqAs6u2smuM/Wr5jdE1Au/JSA1KP97XcqTs5I58XcSP5r yex3FB5Wy5lXvpiugKxs3QhakK3bU5DfB3xcIb2EKBTHRWy0sTIwk++YXfmZyVkKIA08b V+SBSQ0UFWUT6ZCgikwURtV0e15zFlZOMew8DDMs+6vyMv2fJ0shmOnqYTP8VUQDc4g== 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=TkG7vWPC; 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 84430606A32C; Fri, 4 Dec 2026 11:09:41 +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=TkG7vWPC Received: by smtp.kernel.org (Postfix) with ESMTPSA id B264D1F000CE; Fri, 4 Dec 2026 11:09:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382581; bh=Zfil/ipYETqKmtXhx3Y6RMMkbUkQw/QYiRfeWgrTvr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TkG7vWPCK+7lFXedJwQmUwHavwq+MCZgN/20bTw7Xvn1kh27vK7vSddsElVjZzFCG htRg4DhlQD9RCjggfz2DuDSbfeKXTUePRRG/4pKNV4WUEmIFyt5Vawa9b5/Hwzkduh FuGwIaSdaVqh0RNiWYvJhWDC79ZTn4abVfxAfYio= 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.18 515/703] s390/dcssblk: Initialize device semaphore before sysfs registration Date: Fri, 4 Dec 2026 19:06:54 +0900 Message-ID: <20261204100641.497232890@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 @@ -102,7 +102,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. @@ -1030,7 +1030,6 @@ dcssblk_init(void) if (rc < 0) goto out_root; dcssblk_major = rc; - init_rwsem(&dcssblk_devices_sem); dcssblk_check_params(); return 0;