mirror of
https://git.yoctoproject.org/meta-ti
synced 2026-07-16 22:38:04 +00:00
2177f80076
Duplicate patches between PSP and 3.2.17 have been dropped from the 3.2.17 series Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
57 lines
1.7 KiB
Diff
57 lines
1.7 KiB
Diff
From fadd4263bca7146d233ff944c17cb0f42a6e2112 Mon Sep 17 00:00:00 2001
|
|
From: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
|
|
Date: Wed, 28 Mar 2012 09:30:50 +0200
|
|
Subject: [PATCH 032/165] usb: gadget: eliminate NULL pointer dereference
|
|
(bugfix)
|
|
|
|
commit 92b0abf80c5c5f0e0d71d1309688a330fd74731b upstream.
|
|
|
|
usb: gadget: eliminate NULL pointer dereference (bugfix)
|
|
|
|
This patch fixes a bug which causes NULL pointer dereference in
|
|
ffs_ep0_ioctl. The bug happens when the FunctionFS is not bound (either
|
|
has not been bound yet or has been bound and then unbound) and can be
|
|
reproduced with running the following commands:
|
|
|
|
$ insmod g_ffs.ko
|
|
$ mount -t functionfs func /dev/usbgadget
|
|
$ ./null
|
|
|
|
where null.c is:
|
|
|
|
#include <fcntl.h>
|
|
#include <linux/usb/functionfs.h>
|
|
|
|
int main(void)
|
|
{
|
|
int fd = open("/dev/usbgadget/ep0", O_RDWR);
|
|
ioctl(fd, FUNCTIONFS_CLEAR_HALT);
|
|
|
|
return 0;
|
|
}
|
|
|
|
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
|
|
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
|
|
Signed-off-by: Felipe Balbi <balbi@ti.com>
|
|
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
|
---
|
|
drivers/usb/gadget/f_fs.c | 2 +-
|
|
1 files changed, 1 insertions(+), 1 deletions(-)
|
|
|
|
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
|
|
index acb3800..0e641a1 100644
|
|
--- a/drivers/usb/gadget/f_fs.c
|
|
+++ b/drivers/usb/gadget/f_fs.c
|
|
@@ -712,7 +712,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)
|
|
if (code == FUNCTIONFS_INTERFACE_REVMAP) {
|
|
struct ffs_function *func = ffs->func;
|
|
ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;
|
|
- } else if (gadget->ops->ioctl) {
|
|
+ } else if (gadget && gadget->ops->ioctl) {
|
|
ret = gadget->ops->ioctl(gadget, code, value);
|
|
} else {
|
|
ret = -ENOTTY;
|
|
--
|
|
1.7.7.6
|
|
|