lkml.org 
[lkml]   [2013]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/4] staging: ozwpan: Fixes crash due to invalid port aceess.
Date
This patch fixes kernel crash issue, when we receive URB request
after de-enumerating device.

Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
---
drivers/staging/ozwpan/ozhcd.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c
index ed63868..d313a63 100644
--- a/drivers/staging/ozwpan/ozhcd.c
+++ b/drivers/staging/ozwpan/ozhcd.c
@@ -480,10 +480,14 @@ static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
oz_free_urb_link(urbl);
return 0;
}
- if (in_dir)
+ if (in_dir && port->in_ep[ep_addr])
ep = port->in_ep[ep_addr];
- else
+ else if (!in_dir && port->out_ep[ep_addr])
ep = port->out_ep[ep_addr];
+ else {
+ err = -ENOMEM;
+ goto out;
+ }

/*For interrupt endpoint check for buffered data
* & complete urb
@@ -505,6 +509,7 @@ static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
} else {
err = -EPIPE;
}
+out:
spin_unlock_bh(&port->ozhcd->hcd_lock);
if (err)
oz_free_urb_link(urbl);
--
1.7.9.5


\
 
 \ /
  Last update: 2013-08-05 20:01    [W:0.079 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site