diff options
author | David Howells <dhowells@redhat.com> | 2008-11-13 18:38:43 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-11-13 18:38:43 -0500 |
commit | cd80ca8a03fd712b046028c1f66e10f3aec43eee (patch) | |
tree | d6efed2feec6c1e948261fd544427be3d7109567 /drivers/usb | |
parent | ee9785ada3573700efe77b78c03d4e26a4e1bf26 (diff) |
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/devio.c | 8 | ||||
-rw-r--r-- | drivers/usb/core/inode.c | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 2bccefebff1b..1aadb9387027 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -617,8 +617,8 @@ static int usbdev_open(struct inode *inode, struct file *file) | |||
617 | init_waitqueue_head(&ps->wait); | 617 | init_waitqueue_head(&ps->wait); |
618 | ps->discsignr = 0; | 618 | ps->discsignr = 0; |
619 | ps->disc_pid = get_pid(task_pid(current)); | 619 | ps->disc_pid = get_pid(task_pid(current)); |
620 | ps->disc_uid = current->uid; | 620 | ps->disc_uid = current_uid(); |
621 | ps->disc_euid = current->euid; | 621 | ps->disc_euid = current_euid(); |
622 | ps->disccontext = NULL; | 622 | ps->disccontext = NULL; |
623 | ps->ifclaimed = 0; | 623 | ps->ifclaimed = 0; |
624 | security_task_getsecid(current, &ps->secid); | 624 | security_task_getsecid(current, &ps->secid); |
@@ -1174,8 +1174,8 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1174 | as->signr = uurb->signr; | 1174 | as->signr = uurb->signr; |
1175 | as->ifnum = ifnum; | 1175 | as->ifnum = ifnum; |
1176 | as->pid = get_pid(task_pid(current)); | 1176 | as->pid = get_pid(task_pid(current)); |
1177 | as->uid = current->uid; | 1177 | as->uid = current_uid(); |
1178 | as->euid = current->euid; | 1178 | as->euid = current_euid(); |
1179 | security_task_getsecid(current, &as->secid); | 1179 | security_task_getsecid(current, &as->secid); |
1180 | if (!is_in) { | 1180 | if (!is_in) { |
1181 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, | 1181 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 94632264dccf..185be760833e 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -277,8 +277,8 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de | |||
277 | 277 | ||
278 | if (inode) { | 278 | if (inode) { |
279 | inode->i_mode = mode; | 279 | inode->i_mode = mode; |
280 | inode->i_uid = current->fsuid; | 280 | inode->i_uid = current_fsuid(); |
281 | inode->i_gid = current->fsgid; | 281 | inode->i_gid = current_fsgid(); |
282 | inode->i_blocks = 0; | 282 | inode->i_blocks = 0; |
283 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 283 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
284 | switch (mode & S_IFMT) { | 284 | switch (mode & S_IFMT) { |