| From dc2440d69ee81aff9c56ec8ded0fd37b7b344130 Mon Sep 17 00:00:00 2001 |
| From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| Date: Wed, 17 Jun 2020 12:28:23 +0200 |
| Subject: [PATCH] Revert "zram: convert remaining CLASS_ATTR() to |
| CLASS_ATTR_RO()" |
| |
| Turns out that the permissions for 0400 really are what we want here, |
| otherwise any user can write to this file. |
| |
| Reported-by: Wade Mealing <wmealing@redhat.com> |
| Cc: stable <stable@vger.kernel.org> |
| 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 <gregkh@linuxfoundation.org> |
| --- |
| drivers/block/zram/zram_drv.c | 3 ++- |
| 1 file changed, 2 insertions(+), 1 deletion(-) |
| |
| --- 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 |
| 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, |