From mboxrd@z Thu Jan 1 00:00:00 1970 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 097F3583AB3; Wed, 9 Sep 2026 14:40:27 +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=1788964828; cv=none; b=r5964KfwawXqpy4zEyeWQc1ad+PwPa3qv8fI7X7tenFY9s4Ps4DYiNkQpDwZKMNtPwduoOtNZ8OEIZ+2hwe9ZGZnKdLEysCtSYSCNZLs5BHGtRUWT0pM7V9i5c6WN9TCcR1FzPdQdNqLTeEeqg1J2Gq7JLjC1Qc11amjebXrbtw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964828; c=relaxed/simple; bh=JcbAi3mFLxNeZMlYBbFmlWmWnFLul6pN1TjOYXO1Jmo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kvydIdh1AQPpsY8ZRI1h6psLYR4AZL5xD0RylqnWLA++h96nQGu9TYs1gZkV1kmRp3cjuv+m4dO23IEEY0XV40TtW40Q8WoRapZTHsbNC1gIar7wfIJgjMKS1qVfsdqtoPYcKjYhwNydv/dH2miCL7/m/e4A6xuZ/I4bwrzS6oQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aKNTVZt1; 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="aKNTVZt1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6804A1F00A3A; Wed, 9 Sep 2026 14:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788964826; bh=8LJPWkhk//1HjVrTXL7p3vMSp1krmiLuRetgU89rpYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aKNTVZt1sffQBj6ydvaVozKl8+RUYrDzlju9vrUkNWPah2Is/ucKTjx3eE9hjKXfG CtGdD/UritMdXm9sEK14dyr1anR1meB1MqU05dvISfMy5yPILM6OiZhhn012g6P+7g 29pBIbRDIt/00Gc78W+qVLcMi/3/hBmMeV28DQfE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sergey Senozhatsky , Brian Geffon , Minchan Kim , Richard Chang , Yuwen Chen , Andrew Morton , Sasha Levin Subject: [PATCH 6.18 555/583] zram: take write lock in wb limit store handlers Date: Wed, 9 Sep 2026 15:44:00 +0200 Message-ID: <20260909134256.929239155@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909134237.773280130@linuxfoundation.org> References: <20260909134237.773280130@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 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sergey Senozhatsky [ Upstream commit 7c929664fddfdaaa4afe5ae833d0f3044709d95c ] Write device attrs handlers should take write zram init_lock. While at it, fixup coding styles. Link: https://lkml.kernel.org/r/20251122074029.3948921-4-senozhatsky@chromium.org Signed-off-by: Sergey Senozhatsky Reviewed-by: Brian Geffon Cc: Minchan Kim Cc: Richard Chang Cc: Yuwen Chen Signed-off-by: Andrew Morton Stable-dep-of: dde75313eed0 ("zram: set default primary compressor in zram_destroy_comps()") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/block/zram/zram_drv.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -501,7 +501,8 @@ out: #ifdef CONFIG_ZRAM_WRITEBACK static ssize_t writeback_limit_enable_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct zram *zram = dev_to_zram(dev); u64 val; @@ -510,18 +511,19 @@ static ssize_t writeback_limit_enable_st if (kstrtoull(buf, 10, &val)) return ret; - down_read(&zram->init_lock); + down_write(&zram->init_lock); spin_lock(&zram->wb_limit_lock); zram->wb_limit_enable = val; spin_unlock(&zram->wb_limit_lock); - up_read(&zram->init_lock); + up_write(&zram->init_lock); ret = len; return ret; } static ssize_t writeback_limit_enable_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, + char *buf) { bool val; struct zram *zram = dev_to_zram(dev); @@ -536,7 +538,8 @@ static ssize_t writeback_limit_enable_sh } static ssize_t writeback_limit_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct zram *zram = dev_to_zram(dev); u64 val; @@ -545,11 +548,11 @@ static ssize_t writeback_limit_store(str if (kstrtoull(buf, 10, &val)) return ret; - down_read(&zram->init_lock); + down_write(&zram->init_lock); spin_lock(&zram->wb_limit_lock); zram->bd_wb_limit = val; spin_unlock(&zram->wb_limit_lock); - up_read(&zram->init_lock); + up_write(&zram->init_lock); ret = len; return ret;