USB: snoop processes opening usbfs device files
authorAlan Stern <stern@rowland.harvard.edu>
Mon, 6 Oct 2008 15:24:26 +0000 (11:24 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 17 Oct 2008 21:41:03 +0000 (14:41 -0700)
This patch (as1148) adds a new "snoop" message to usbfs when a device
file is opened, identifying the process responsible.  This comes in
extremely handy when trying to determine which program is doing some
unwanted USB access.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/devio.c

index 7a4fa791dc196f18a042e4c203ca21b5a0313e97..528befdcc7813b64e42aa345eb32dcddf4c9108e 100644 (file)
@@ -624,6 +624,8 @@ static int usbdev_open(struct inode *inode, struct file *file)
        smp_wmb();
        list_add_tail(&ps->list, &dev->filelist);
        file->private_data = ps;
+       snoop(&dev->dev, "opened by process %d: %s\n", task_pid_nr(current),
+                       current->comm);
  out:
        if (ret) {
                kfree(ps);