From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 6 Dec 2016 00:57:28 +0900 From: Sergey Senozhatsky To: Greg KH Cc: Sergey Senozhatsky , Andrew Morton , Minchan Kim , Steven Allen , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCHv2] zram: restrict add/remove attributes to root only Message-ID: <20161205155728.GA5014@tigerII.localdomain> References: <20161204124413.22595-1-sergey.senozhatsky@gmail.com> <20161205125719.GE19696@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161205125719.GE19696@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: On (12/05/16 13:57), Greg KH wrote: > > +/* > > + * NOTE: hot_add attribute is not the usual read-only sysfs > > + * attribute. In a sence that reading from this file does alter > > + * the state of your system -- it creates a new un-initialized > > + * zram device and returns back this device's device_id (or an > > + * error code if it fails to create a new device). > > + */ > > static struct class_attribute zram_control_class_attrs[] = { > > - __ATTR_RO(hot_add), > > - __ATTR_WO(hot_remove), > > + __ATTR(hot_add, 0400, hot_add_show, NULL), > > + __ATTR(hot_remove, 0200, NULL, hot_remove_store), > > You can leave hot_remove as __ATTR_WO(), right? yes. I changed it deliberately. > Please do so if at all possible. ok. -ss