* [patch 1/2] usbhid: use after free
@ 2011-05-26 8:49 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2011-05-26 8:49 UTC (permalink / raw)
To: Jiri Kosina
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
There are a couple use after free bugs here.
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Compile tested only. Please review carefully.
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index ff3c644..b2f9a3a 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -248,12 +248,15 @@ static int hiddev_release(struct inode * inode, struct file * file)
usbhid_close(list->hiddev->hid);
usbhid_put_power(list->hiddev->hid);
} else {
+ mutex_unlock(&list->hiddev->existancelock);
kfree(list->hiddev);
+ kfree(list);
+ return 0;
}
}
- kfree(list);
mutex_unlock(&list->hiddev->existancelock);
+ kfree(list);
return 0;
}
@@ -926,7 +929,9 @@ void hiddev_disconnect(struct hid_device *hid)
usbhid_close(hiddev->hid);
wake_up_interruptible(&hiddev->wait);
} else {
+ mutex_unlock(&hiddev->existancelock);
kfree(hiddev);
+ return;
}
mutex_unlock(&hiddev->existancelock);
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [patch 1/2] usbhid: use after free
@ 2011-05-26 8:49 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2011-05-26 8:49 UTC (permalink / raw)
To: Jiri Kosina
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
There are a couple use after free bugs here.
Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
Compile tested only. Please review carefully.
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index ff3c644..b2f9a3a 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -248,12 +248,15 @@ static int hiddev_release(struct inode * inode, struct file * file)
usbhid_close(list->hiddev->hid);
usbhid_put_power(list->hiddev->hid);
} else {
+ mutex_unlock(&list->hiddev->existancelock);
kfree(list->hiddev);
+ kfree(list);
+ return 0;
}
}
- kfree(list);
mutex_unlock(&list->hiddev->existancelock);
+ kfree(list);
return 0;
}
@@ -926,7 +929,9 @@ void hiddev_disconnect(struct hid_device *hid)
usbhid_close(hiddev->hid);
wake_up_interruptible(&hiddev->wait);
} else {
+ mutex_unlock(&hiddev->existancelock);
kfree(hiddev);
+ return;
}
mutex_unlock(&hiddev->existancelock);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch 1/2] usbhid: use after free
2011-05-26 8:49 ` Dan Carpenter
@ 2011-05-26 12:03 ` Jiri Kosina
-1 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2011-05-26 12:03 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-usb, linux-input, kernel-janitors
On Thu, 26 May 2011, Dan Carpenter wrote:
> There are a couple use after free bugs here.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> Compile tested only. Please review carefully.
>
> diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
> index ff3c644..b2f9a3a 100644
> --- a/drivers/hid/usbhid/hiddev.c
> +++ b/drivers/hid/usbhid/hiddev.c
> @@ -248,12 +248,15 @@ static int hiddev_release(struct inode * inode, struct file * file)
> usbhid_close(list->hiddev->hid);
> usbhid_put_power(list->hiddev->hid);
> } else {
> + mutex_unlock(&list->hiddev->existancelock);
> kfree(list->hiddev);
> + kfree(list);
> + return 0;
> }
> }
>
> - kfree(list);
> mutex_unlock(&list->hiddev->existancelock);
> + kfree(list);
Good catch.
> return 0;
> }
> @@ -926,7 +929,9 @@ void hiddev_disconnect(struct hid_device *hid)
> usbhid_close(hiddev->hid);
> wake_up_interruptible(&hiddev->wait);
> } else {
> + mutex_unlock(&hiddev->existancelock);
> kfree(hiddev);
> + return;
> }
> mutex_unlock(&hiddev->existancelock);
For this I already have a fix queued in my tree.
So I will be applying only the first hunk.
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch 1/2] usbhid: use after free
@ 2011-05-26 12:03 ` Jiri Kosina
0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2011-05-26 12:03 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-usb, linux-input, kernel-janitors
On Thu, 26 May 2011, Dan Carpenter wrote:
> There are a couple use after free bugs here.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> Compile tested only. Please review carefully.
>
> diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
> index ff3c644..b2f9a3a 100644
> --- a/drivers/hid/usbhid/hiddev.c
> +++ b/drivers/hid/usbhid/hiddev.c
> @@ -248,12 +248,15 @@ static int hiddev_release(struct inode * inode, struct file * file)
> usbhid_close(list->hiddev->hid);
> usbhid_put_power(list->hiddev->hid);
> } else {
> + mutex_unlock(&list->hiddev->existancelock);
> kfree(list->hiddev);
> + kfree(list);
> + return 0;
> }
> }
>
> - kfree(list);
> mutex_unlock(&list->hiddev->existancelock);
> + kfree(list);
Good catch.
> return 0;
> }
> @@ -926,7 +929,9 @@ void hiddev_disconnect(struct hid_device *hid)
> usbhid_close(hiddev->hid);
> wake_up_interruptible(&hiddev->wait);
> } else {
> + mutex_unlock(&hiddev->existancelock);
> kfree(hiddev);
> + return;
> }
> mutex_unlock(&hiddev->existancelock);
For this I already have a fix queued in my tree.
So I will be applying only the first hunk.
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-05-26 12:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26 8:49 [patch 1/2] usbhid: use after free Dan Carpenter
2011-05-26 8:49 ` Dan Carpenter
2011-05-26 12:03 ` Jiri Kosina
2011-05-26 12:03 ` Jiri Kosina
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.