From: Alan Stern Date: Mon, 6 Oct 2008 15:24:26 +0000 (-0400) Subject: USB: snoop processes opening usbfs device files X-Git-Tag: v2.6.28-rc1~254^2~35 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=2da41d5f6c036e7a6e496a7e601a685f8b87acb0;p=linux-2.6-omap-h63xx.git USB: snoop processes opening usbfs device files 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 7a4fa791dc1..528befdcc78 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -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);