Skip to content

Commit e24d7ac

Browse files
committed
USB: misc: usbsevseg: fix up some sysfs attribute permissions
They should not be writable by any user. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Harrison Metzger <harrisonmetz@gmail.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 48f1154 commit e24d7ac

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎drivers/usb/misc/usbsevseg.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static ssize_t set_attr_##name(struct device *dev, \
192192
\
193193
return count; \
194194
} \
195-
static DEVICE_ATTR(name, S_IWUGO | S_IRUGO, show_attr_##name, set_attr_##name);
195+
static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name);
196196

197197
static ssize_t show_attr_text(struct device *dev,
198198
struct device_attribute *attr, char *buf)
@@ -223,7 +223,7 @@ static ssize_t set_attr_text(struct device *dev,
223223
return count;
224224
}
225225

226-
static DEVICE_ATTR(text, S_IWUGO | S_IRUGO, show_attr_text, set_attr_text);
226+
static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text);
227227

228228
static ssize_t show_attr_decimals(struct device *dev,
229229
struct device_attribute *attr, char *buf)
@@ -272,8 +272,7 @@ static ssize_t set_attr_decimals(struct device *dev,
272272
return count;
273273
}
274274

275-
static DEVICE_ATTR(decimals, S_IWUGO | S_IRUGO,
276-
show_attr_decimals, set_attr_decimals);
275+
static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals);
277276

278277
static ssize_t show_attr_textmode(struct device *dev,
279278
struct device_attribute *attr, char *buf)
@@ -319,8 +318,7 @@ static ssize_t set_attr_textmode(struct device *dev,
319318
return -EINVAL;
320319
}
321320

322-
static DEVICE_ATTR(textmode, S_IWUGO | S_IRUGO,
323-
show_attr_textmode, set_attr_textmode);
321+
static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode);
324322

325323

326324
MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered);

0 commit comments

Comments
 (0)