[RFC][PATCH 17/20] usb: Fixup usb so it works with pspaces.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Eric W. Biederman <[email protected]>


---

 drivers/usb/core/devio.c |   12 ++++++++++--
 drivers/usb/core/inode.c |    4 +++-
 drivers/usb/core/usb.h   |    1 +
 3 files changed, 14 insertions(+), 3 deletions(-)

94873f6924179bc2ee782f6fb72d5e855c780a1b
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 2b68998..7bccb9a 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -47,6 +47,7 @@
 #include <linux/usbdevice_fs.h>
 #include <linux/cdev.h>
 #include <linux/notifier.h>
+#include <linux/pspace.h>
 #include <asm/uaccess.h>
 #include <asm/byteorder.h>
 #include <linux/moduleparam.h>
@@ -61,6 +62,7 @@ static struct class *usb_device_class;
 struct async {
 	struct list_head asynclist;
 	struct dev_state *ps;
+	struct pspace *pspace;
 	pid_t pid;
 	uid_t uid, euid;
 	unsigned int signr;
@@ -224,6 +226,7 @@ static struct async *alloc_async(unsigne
 
 static void free_async(struct async *as)
 {
+	put_pspace(as->pspace);
 	kfree(as->urb->transfer_buffer);
 	kfree(as->urb->setup_packet);
 	usb_free_urb(as->urb);
@@ -316,8 +319,8 @@ static void async_completed(struct urb *
 		sinfo.si_errno = as->urb->status;
 		sinfo.si_code = SI_ASYNCIO;
 		sinfo.si_addr = as->userurb;
-		kill_proc_info_as_uid(as->signr, &sinfo, as->pid, as->uid, 
-				      as->euid);
+		kill_proc_info_as_uid(as->signr, &sinfo, as->pspace, as->pid,
+					 as->uid, as->euid);
 	}
 	snoop(&urb->dev->dev, "urb complete\n");
 	snoop_urb(urb, as->userurb);
@@ -571,6 +574,8 @@ static int usbdev_open(struct inode *ino
 	INIT_LIST_HEAD(&ps->async_completed);
 	init_waitqueue_head(&ps->wait);
 	ps->discsignr = 0;
+	ps->disc_pspace = current->pspace;
+	get_pspace(ps->disc_pspace);
 	ps->disc_pid = current->pid;
 	ps->disc_uid = current->uid;
 	ps->disc_euid = current->euid;
@@ -601,6 +606,7 @@ static int usbdev_release(struct inode *
 	destroy_all_async(ps);
 	usb_unlock_device(dev);
 	usb_put_dev(dev);
+	put_pspace(ps->disc_pspace);
 	ps->dev = NULL;
 	kfree(ps);
         return 0;
@@ -1054,6 +1060,8 @@ static int proc_do_submiturb(struct dev_
 		as->userbuffer = NULL;
 	as->signr = uurb->signr;
 	as->ifnum = ifnum;
+	as->pspace = current->pspace;
+	get_pspace(as->pspace);
 	as->pid = current->pid;
 	as->uid = current->uid;
 	as->euid = current->euid;
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 3cf945c..94c91b3 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -700,7 +700,9 @@ static void usbfs_remove_device(struct u
 			sinfo.si_errno = EPIPE;
 			sinfo.si_code = SI_ASYNCIO;
 			sinfo.si_addr = ds->disccontext;
-			kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid);
+			kill_proc_info_as_uid(ds->discsignr, &sinfo,
+						ds->disc_pspace, ds->disc_pid,
+						ds->disc_uid, ds->disc_euid);
 		}
 	}
 }
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 4647e1e..512c5c7 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -73,6 +73,7 @@ struct dev_state {
 	struct list_head async_completed;
 	wait_queue_head_t wait;     /* wake up if a request completed */
 	unsigned int discsignr;
+	struct pspace *disc_pspace;
 	pid_t disc_pid;
 	uid_t disc_uid, disc_euid;
 	void __user *disccontext;
-- 
1.1.5.g3480

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux