It's not just HIDIOCGVERSION. A couple of other commands
(HIDIOCGFLAG/HIDIOCSFLAG) didn't check device existence in the first
place either.
Current implementation depends on when the device is actually removed.
If it has been removed before the hiddev_ioctl(), hiddev_ioctl() returns
-EIO.
If the device is removed while hiddev_ioctl() is in progress, we either
do not notice that and handle HIDIOCGVERSION and HIDIOCGFLAG/HIDIOCSFLAG
just fine, or return -ENODEV.
I'll submit a patch in a bit that applies on top of the "[PATCH] USB:
USBHID: Fix race between disconnect and hiddev_ioctl" and makes the
hiddev_ioctl() check
device existence before processing the command and always return -ENODEV
in case the device has been removed.
Thanks,
Val.
--