diff options
-rw-r--r-- | security/device_cgroup.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/security/device_cgroup.c b/security/device_cgroup.c index 9da3532726ff..7bd296cca041 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c | |||
@@ -202,7 +202,7 @@ static struct cgroup_subsys_state *devcgroup_create(struct cgroup_subsys *ss, | |||
202 | } | 202 | } |
203 | wh->minor = wh->major = ~0; | 203 | wh->minor = wh->major = ~0; |
204 | wh->type = DEV_ALL; | 204 | wh->type = DEV_ALL; |
205 | wh->access = ACC_MKNOD | ACC_READ | ACC_WRITE; | 205 | wh->access = ACC_MASK; |
206 | list_add(&wh->list, &dev_cgroup->whitelist); | 206 | list_add(&wh->list, &dev_cgroup->whitelist); |
207 | } else { | 207 | } else { |
208 | parent_dev_cgroup = cgroup_to_devcgroup(parent_cgroup); | 208 | parent_dev_cgroup = cgroup_to_devcgroup(parent_cgroup); |
@@ -264,11 +264,10 @@ static char type_to_char(short type) | |||
264 | 264 | ||
265 | static void set_majmin(char *str, unsigned m) | 265 | static void set_majmin(char *str, unsigned m) |
266 | { | 266 | { |
267 | memset(str, 0, MAJMINLEN); | ||
268 | if (m == ~0) | 267 | if (m == ~0) |
269 | sprintf(str, "*"); | 268 | strcpy(str, "*"); |
270 | else | 269 | else |
271 | snprintf(str, MAJMINLEN, "%u", m); | 270 | sprintf(str, "%u", m); |
272 | } | 271 | } |
273 | 272 | ||
274 | static int devcgroup_seq_read(struct cgroup *cgroup, struct cftype *cft, | 273 | static int devcgroup_seq_read(struct cgroup *cgroup, struct cftype *cft, |
@@ -360,6 +359,7 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
360 | { | 359 | { |
361 | struct dev_cgroup *cur_devcgroup; | 360 | struct dev_cgroup *cur_devcgroup; |
362 | const char *b; | 361 | const char *b; |
362 | char *endp; | ||
363 | int retval = 0, count; | 363 | int retval = 0, count; |
364 | struct dev_whitelist_item wh; | 364 | struct dev_whitelist_item wh; |
365 | 365 | ||
@@ -395,11 +395,8 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
395 | wh.major = ~0; | 395 | wh.major = ~0; |
396 | b++; | 396 | b++; |
397 | } else if (isdigit(*b)) { | 397 | } else if (isdigit(*b)) { |
398 | wh.major = 0; | 398 | wh.major = simple_strtoul(b, &endp, 10); |
399 | while (isdigit(*b)) { | 399 | b = endp; |
400 | wh.major = wh.major*10+(*b-'0'); | ||
401 | b++; | ||
402 | } | ||
403 | } else { | 400 | } else { |
404 | return -EINVAL; | 401 | return -EINVAL; |
405 | } | 402 | } |
@@ -412,11 +409,8 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
412 | wh.minor = ~0; | 409 | wh.minor = ~0; |
413 | b++; | 410 | b++; |
414 | } else if (isdigit(*b)) { | 411 | } else if (isdigit(*b)) { |
415 | wh.minor = 0; | 412 | wh.minor = simple_strtoul(b, &endp, 10); |
416 | while (isdigit(*b)) { | 413 | b = endp; |
417 | wh.minor = wh.minor*10+(*b-'0'); | ||
418 | b++; | ||
419 | } | ||
420 | } else { | 414 | } else { |
421 | return -EINVAL; | 415 | return -EINVAL; |
422 | } | 416 | } |