From patchwork Wed Jun 17 10:34:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 11609601 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5282190 for ; Wed, 17 Jun 2020 10:34:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E25C20CC7 for ; Wed, 17 Jun 2020 10:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592390062; bh=05pv3vIG2hLtGzWurD18/Pe9Bk8FpvgeJDdod0TO2p8=; h=Date:From:To:Cc:Subject:List-ID:From; b=ctvQUsQW/P02jXpbVfHa7wk/1eLwThG9YabKdgVKHinA5MZfONari2tdcDW1zSXBW FCWZD4ZhP44WLY3pm0iYaDkczCgTGIvrqwX2EQOOLMqt0OzhouS9vGlZSVZNaS2Phn YfTqFg3TnzWI6F++ktenBUpjubceD6Y6eq9y5FXQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726523AbgFQKeV (ORCPT ); Wed, 17 Jun 2020 06:34:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:46534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726275AbgFQKeV (ORCPT ); Wed, 17 Jun 2020 06:34:21 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4DC4F208B3; Wed, 17 Jun 2020 10:34:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592390060; bh=05pv3vIG2hLtGzWurD18/Pe9Bk8FpvgeJDdod0TO2p8=; h=Date:From:To:Cc:Subject:From; b=NN6jxyzu2WEdh1EfQLHcBJLBZzI23Xm+ouHzjpn8BMpGFWUypYcLlnvqInOSKzIZ2 6d2cqTCv8OEjdbF5L0TDJEKgQI7M6HIZh6xjHHonPCPPErydpZHRtn42pUdGizDGyy olB2BCXFKWDWIA4kRsLYKlpre4YBfJvK3RXqu1J0= Date: Wed, 17 Jun 2020 12:34:12 +0200 From: Greg Kroah-Hartman To: Minchan Kim , Nitin Gupta Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Wade Mealing , Sergey Senozhatsky , Jens Axboe Subject: [PATCH] Revert "zram: convert remaining CLASS_ATTR() to CLASS_ATTR_RO()" Message-ID: <20200617103412.GA2027053@kroah.com> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Wade Mealing Turns out that the permissions for 0400 really are what we want here, otherwise any user can write to this file. [fixed formatting and made static - gregkh] Reported-by: Wade Mealing Cc: stable Fixes: f40609d1591f ("zram: convert remaining CLASS_ATTR() to CLASS_ATTR_RO()") Link: https://bugzilla.redhat.com/show_bug.cgi?id=1847832 Signed-off-by: Greg Kroah-Hartman --- drivers/block/zram/zram_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 6e2ad90b17a3..270dd810be54 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -2021,7 +2021,8 @@ static ssize_t hot_add_show(struct class *class, return ret; return scnprintf(buf, PAGE_SIZE, "%d\n", ret); } -static CLASS_ATTR_RO(hot_add); +static struct class_attribute class_attr_hot_add = + __ATTR(hot_add, 0400, hot_add_show, NULL); static ssize_t hot_remove_store(struct class *class, struct class_attribute *attr,