On Wed, Oct 09, 2002 at 03:50:41AM -0500, Maciej Babinski wrote:
> I get a NULL pointer dereference by running "cat" on /dev/misc/uinput
> I'm a newbie, but I think the patch at the bottom fixes it.
> --- linux-2.5.41/drivers/input/misc/uinput.c Mon Oct 7 13:24:50 2002
> +++ linux-2.5.41.new/drivers/input/misc/uinput.c Wed Oct 9 03:47:15 2002
> @@ -224,15 +224,14 @@
>
> udev = (struct uinput_device *)file->private_data;
>
> + if (!(udev->state & UIST_CREATED))
> + return -ENODEV;
> +
> if (udev->head == udev->tail) {
> add_wait_queue(&udev->waitq, &waitq);
> current->state = TASK_INTERRUPTIBLE;
>
> while (udev->head == udev->tail) {
> - if (!(udev->state & UIST_CREATED)) {
> - retval = -ENODEV;
> - break;
> - }
> if (file->f_flags & O_NONBLOCK) {
> retval = -EAGAIN;
> break;
Your patch is almost correct - you have to keep both the checks. The
first could happen when the device disappears while being waited for.
-- Vojtech Pavlik SuSE Labs - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:30 EST