Commit cd80ca8a03fd712b046028c1f66e10f3aec43eee

Authored by David Howells
Committed by James Morris
1 parent ee9785ada3

CRED: Wrap task credential accesses in the USB driver

Wrap access to task credentials so that they can be separated more easily from
the task_struct during the introduction of COW creds.

Change most current->(|e|s|fs)[ug]id to current_(|e|s|fs)[ug]id().

Change some task->e?[ug]id to task_e?[ug]id().  In some places it makes more
sense to use RCU directly rather than a convenient wrapper; these will be
addressed by later patches.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-usb@vger.kernel.org
Signed-off-by: James Morris <jmorris@namei.org>

Showing 2 changed files with 6 additions and 6 deletions Side-by-side Diff

drivers/usb/core/devio.c
... ... @@ -617,8 +617,8 @@
617 617 init_waitqueue_head(&ps->wait);
618 618 ps->discsignr = 0;
619 619 ps->disc_pid = get_pid(task_pid(current));
620   - ps->disc_uid = current->uid;
621   - ps->disc_euid = current->euid;
  620 + ps->disc_uid = current_uid();
  621 + ps->disc_euid = current_euid();
622 622 ps->disccontext = NULL;
623 623 ps->ifclaimed = 0;
624 624 security_task_getsecid(current, &ps->secid);
... ... @@ -1174,8 +1174,8 @@
1174 1174 as->signr = uurb->signr;
1175 1175 as->ifnum = ifnum;
1176 1176 as->pid = get_pid(task_pid(current));
1177   - as->uid = current->uid;
1178   - as->euid = current->euid;
  1177 + as->uid = current_uid();
  1178 + as->euid = current_euid();
1179 1179 security_task_getsecid(current, &as->secid);
1180 1180 if (!is_in) {
1181 1181 if (copy_from_user(as->urb->transfer_buffer, uurb->buffer,
drivers/usb/core/inode.c
... ... @@ -277,8 +277,8 @@
277 277  
278 278 if (inode) {
279 279 inode->i_mode = mode;
280   - inode->i_uid = current->fsuid;
281   - inode->i_gid = current->fsgid;
  280 + inode->i_uid = current_fsuid();
  281 + inode->i_gid = current_fsgid();
282 282 inode->i_blocks = 0;
283 283 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
284 284 switch (mode & S_IFMT) {