diff options
author | David Howells <dhowells@redhat.com> | 2008-11-13 18:39:18 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-11-13 18:39:18 -0500 |
commit | 86a264abe542cfececb4df129bc45a0338d8cdb9 (patch) | |
tree | 30152f04ba847f311028d5ca697f864c16c7ebb3 /drivers/usb | |
parent | f1752eec6145c97163dbce62d17cf5d928e28a27 (diff) |
CRED: Wrap current->cred and a few other accessors
Wrap current->cred and a few other accessors to hide their actual
implementation.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/devio.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 1aadb9387027..aa79280df15d 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -574,6 +574,7 @@ static int usbdev_open(struct inode *inode, struct file *file) | |||
574 | { | 574 | { |
575 | struct usb_device *dev = NULL; | 575 | struct usb_device *dev = NULL; |
576 | struct dev_state *ps; | 576 | struct dev_state *ps; |
577 | const struct cred *cred = current_cred(); | ||
577 | int ret; | 578 | int ret; |
578 | 579 | ||
579 | lock_kernel(); | 580 | lock_kernel(); |
@@ -617,8 +618,8 @@ static int usbdev_open(struct inode *inode, struct file *file) | |||
617 | init_waitqueue_head(&ps->wait); | 618 | init_waitqueue_head(&ps->wait); |
618 | ps->discsignr = 0; | 619 | ps->discsignr = 0; |
619 | ps->disc_pid = get_pid(task_pid(current)); | 620 | ps->disc_pid = get_pid(task_pid(current)); |
620 | ps->disc_uid = current_uid(); | 621 | ps->disc_uid = cred->uid; |
621 | ps->disc_euid = current_euid(); | 622 | ps->disc_euid = cred->euid; |
622 | ps->disccontext = NULL; | 623 | ps->disccontext = NULL; |
623 | ps->ifclaimed = 0; | 624 | ps->ifclaimed = 0; |
624 | security_task_getsecid(current, &ps->secid); | 625 | security_task_getsecid(current, &ps->secid); |
@@ -967,6 +968,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
967 | struct usb_host_endpoint *ep; | 968 | struct usb_host_endpoint *ep; |
968 | struct async *as; | 969 | struct async *as; |
969 | struct usb_ctrlrequest *dr = NULL; | 970 | struct usb_ctrlrequest *dr = NULL; |
971 | const struct cred *cred = current_cred(); | ||
970 | unsigned int u, totlen, isofrmlen; | 972 | unsigned int u, totlen, isofrmlen; |
971 | int ret, ifnum = -1; | 973 | int ret, ifnum = -1; |
972 | int is_in; | 974 | int is_in; |
@@ -1174,8 +1176,8 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1174 | as->signr = uurb->signr; | 1176 | as->signr = uurb->signr; |
1175 | as->ifnum = ifnum; | 1177 | as->ifnum = ifnum; |
1176 | as->pid = get_pid(task_pid(current)); | 1178 | as->pid = get_pid(task_pid(current)); |
1177 | as->uid = current_uid(); | 1179 | as->uid = cred->uid; |
1178 | as->euid = current_euid(); | 1180 | as->euid = cred->euid; |
1179 | security_task_getsecid(current, &as->secid); | 1181 | security_task_getsecid(current, &as->secid); |
1180 | if (!is_in) { | 1182 | if (!is_in) { |
1181 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, | 1183 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, |