aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDavid Quigley <dpquigl@tycho.nsa.gov>2006-06-30 04:55:48 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-30 14:25:37 -0400
commit7a01955f99b65622a00ba5c8b39202ddc6fa65f8 (patch)
tree1dc0ce68a00ba3171097dc5da9875fc6ed5b5069 /drivers/usb
parent8f95dc58d0505516f5cc212a966aea2f2cdb5e44 (diff)
[PATCH] SELinux: update USB code with new kill_proc_info_as_uid
This patch updates the USB core to save and pass the sending task secid when sending signals upon AIO completion so that proper security checking can be applied by security modules. Signed-off-by: David Quigley <dpquigl@tycho.nsa.gov> Signed-off-by: James Morris <jmorris@namei.org> Cc: Stephen Smalley <sds@tycho.nsa.gov> Cc: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/devio.c6
-rw-r--r--drivers/usb/core/inode.c2
-rw-r--r--drivers/usb/core/usb.h1
3 files changed, 7 insertions, 2 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index bcbeaf7101d1..f7bdd94b3aa8 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -47,6 +47,7 @@
47#include <linux/usbdevice_fs.h> 47#include <linux/usbdevice_fs.h>
48#include <linux/cdev.h> 48#include <linux/cdev.h>
49#include <linux/notifier.h> 49#include <linux/notifier.h>
50#include <linux/security.h>
50#include <asm/uaccess.h> 51#include <asm/uaccess.h>
51#include <asm/byteorder.h> 52#include <asm/byteorder.h>
52#include <linux/moduleparam.h> 53#include <linux/moduleparam.h>
@@ -68,6 +69,7 @@ struct async {
68 void __user *userbuffer; 69 void __user *userbuffer;
69 void __user *userurb; 70 void __user *userurb;
70 struct urb *urb; 71 struct urb *urb;
72 u32 secid;
71}; 73};
72 74
73static int usbfs_snoop = 0; 75static int usbfs_snoop = 0;
@@ -312,7 +314,7 @@ static void async_completed(struct urb *urb, struct pt_regs *regs)
312 sinfo.si_code = SI_ASYNCIO; 314 sinfo.si_code = SI_ASYNCIO;
313 sinfo.si_addr = as->userurb; 315 sinfo.si_addr = as->userurb;
314 kill_proc_info_as_uid(as->signr, &sinfo, as->pid, as->uid, 316 kill_proc_info_as_uid(as->signr, &sinfo, as->pid, as->uid,
315 as->euid); 317 as->euid, as->secid);
316 } 318 }
317 snoop(&urb->dev->dev, "urb complete\n"); 319 snoop(&urb->dev->dev, "urb complete\n");
318 snoop_urb(urb, as->userurb); 320 snoop_urb(urb, as->userurb);
@@ -572,6 +574,7 @@ static int usbdev_open(struct inode *inode, struct file *file)
572 ps->disc_euid = current->euid; 574 ps->disc_euid = current->euid;
573 ps->disccontext = NULL; 575 ps->disccontext = NULL;
574 ps->ifclaimed = 0; 576 ps->ifclaimed = 0;
577 security_task_getsecid(current, &ps->secid);
575 wmb(); 578 wmb();
576 list_add_tail(&ps->list, &dev->filelist); 579 list_add_tail(&ps->list, &dev->filelist);
577 file->private_data = ps; 580 file->private_data = ps;
@@ -1053,6 +1056,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1053 as->pid = current->pid; 1056 as->pid = current->pid;
1054 as->uid = current->uid; 1057 as->uid = current->uid;
1055 as->euid = current->euid; 1058 as->euid = current->euid;
1059 security_task_getsecid(current, &as->secid);
1056 if (!(uurb->endpoint & USB_DIR_IN)) { 1060 if (!(uurb->endpoint & USB_DIR_IN)) {
1057 if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, as->urb->transfer_buffer_length)) { 1061 if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, as->urb->transfer_buffer_length)) {
1058 free_async(as); 1062 free_async(as);
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index bfc9b28a7242..d0a208de32cf 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -700,7 +700,7 @@ static void usbfs_remove_device(struct usb_device *dev)
700 sinfo.si_errno = EPIPE; 700 sinfo.si_errno = EPIPE;
701 sinfo.si_code = SI_ASYNCIO; 701 sinfo.si_code = SI_ASYNCIO;
702 sinfo.si_addr = ds->disccontext; 702 sinfo.si_addr = ds->disccontext;
703 kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid); 703 kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid, ds->secid);
704 } 704 }
705 } 705 }
706} 706}
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 7a650c763a62..49f69236b420 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -80,6 +80,7 @@ struct dev_state {
80 uid_t disc_uid, disc_euid; 80 uid_t disc_uid, disc_euid;
81 void __user *disccontext; 81 void __user *disccontext;
82 unsigned long ifclaimed; 82 unsigned long ifclaimed;
83 u32 secid;
83}; 84};
84 85
85/* internal notify stuff */ 86/* internal notify stuff */