aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRupesh Gujare <rupesh.gujare@atmel.com>2013-08-05 18:40:12 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-12 14:02:58 -0700
commitbc9aece00a7e7ec4b33900a232ca20455ae1f8b9 (patch)
tree9a498e97fc04d16e06376afbf027d095965d7833
parentb2271b5bdf1fd8b7d5442e2452e9242b88c56e8f (diff)
staging: ozwpan: Fixes crash due to invalid port aceess.
This patch fixes kernel crash issue, when we receive URB request after de-enumerating device. Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/ozwpan/ozhcd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c
index ed63868e602..d313a636f26 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);