USB: gadget: audit sysfs attribute permissions
Convert all USB gadget sysfs attributes to use the _RO or _RW variants, to make them easier to audit and ensure that the permissions are correct. Note, two are left using the DEVICE_ATTR() macro, as there is no DEVICE_ATTR_WO() in Linus's tree, that will happen after 3.12-rc1 is out, a follow-on patch will be sent then. Reviewed-by: Felipe Balbi <balbi@ti.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -- drivers/usb/gadget/composite.c | 8 +++----- drivers/usb/gadget/dummy_hcd.c | 8 ++++---- drivers/usb/gadget/f_mass_storage.c | 14 ++++++-------- drivers/usb/gadget/net2272.c | 4 ++-- drivers/usb/gadget/net2280.c | 18 +++++++++--------- drivers/usb/gadget/storage_common.c | 25 ++++++++++++------------- drivers/usb/gadget/udc-core.c | 14 +++++++------- 7 files changed, 43 insertions(+), 48 deletions(-)
This commit is contained in:
@@ -1424,8 +1424,8 @@ static const struct usb_gadget_ops net2280_ops = {
|
||||
*/
|
||||
|
||||
/* "function" sysfs attribute */
|
||||
static ssize_t
|
||||
show_function (struct device *_dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t function_show(struct device *_dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct net2280 *dev = dev_get_drvdata (_dev);
|
||||
|
||||
@@ -1435,10 +1435,10 @@ show_function (struct device *_dev, struct device_attribute *attr, char *buf)
|
||||
return 0;
|
||||
return scnprintf (buf, PAGE_SIZE, "%s\n", dev->driver->function);
|
||||
}
|
||||
static DEVICE_ATTR (function, S_IRUGO, show_function, NULL);
|
||||
static DEVICE_ATTR_RO(function);
|
||||
|
||||
static ssize_t net2280_show_registers(struct device *_dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
static ssize_t registers_show(struct device *_dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct net2280 *dev;
|
||||
char *next;
|
||||
@@ -1590,10 +1590,10 @@ static ssize_t net2280_show_registers(struct device *_dev,
|
||||
|
||||
return PAGE_SIZE - size;
|
||||
}
|
||||
static DEVICE_ATTR(registers, S_IRUGO, net2280_show_registers, NULL);
|
||||
static DEVICE_ATTR_RO(registers);
|
||||
|
||||
static ssize_t
|
||||
show_queues (struct device *_dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t queues_show(struct device *_dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct net2280 *dev;
|
||||
char *next;
|
||||
@@ -1690,7 +1690,7 @@ done:
|
||||
spin_unlock_irqrestore (&dev->lock, flags);
|
||||
return PAGE_SIZE - size;
|
||||
}
|
||||
static DEVICE_ATTR (queues, S_IRUGO, show_queues, NULL);
|
||||
static DEVICE_ATTR_RO(queues);
|
||||
|
||||
|
||||
#else
|
||||
|
Viittaa uudesa ongelmassa
Block a user