Re: Unable to reap urb after receiving signal using usbfs.

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

 



On Wed, 11 Feb 2015, Dave Mielke wrote:

> [quoted lines by Alan Stern on 2015/02/11 at 15:22 -0500]
> 
> >Well, it's a mystery.  There are exactly two places in the usbfs code 
> >where a signal is sent: async_completed() and usbdev_remove().  As you 
> >can tell from the usbfs_snoop output, async_completed() doesn't get 
> >called until the URB completes.  (And usbdev_remove() gets called only 
> >when the device is disconnected
> 
> I just checked the snoop log again and can verify that the word remove is 
> nowhere in it.
> 
> >besides which, the values you got for si_errno and si_addr were different from 
> >what usbdev_remove() uses.)
> 
> The struct signalfd_siginfo has all zeros (NULL) for si_addr. Only these fields 
> have something in them: si_signo=SIGRTMIN (correct), si_errno=-ENOENT, 
> si_code=SI_ASYNCIO, si_pid, si_int, si_ptr. I'm using 64-bits so si_ptr is 
> bigger than si_int, but the low-order four bytes of si_ptr are the same as 
> what's in si_int. I suspect both are left over junk from somewhere else.
> 
> As an aside: Perhaps usbfs could zero out the whole struct first so that we can 
> be sure of what it considered to be meaningful.

Go ahead and modify the source code to zero out sinfo in 
async_completed().  That's a good security measure in any case, because 
the values do get passed back to the user.

On the other hand, async_completed() always calls snoop(), so if you 
didn't see the "urb complete" line in the snoop output then the signal 
can't be coming from async_completed().

If you think somehow async_completed() is getting called at the wrong 
time, add a dump_stack() call inside the first "if (signr)" block.  
That will show how it got called.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux