I got a failure for allocation of order 3 pages from oz_ep_alloc() function under low memory situation, so while checking the code came across this call for oz_ep_alloc() which may not be handled gracefully.
So do we need to have the below check ?
$ git diff
diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c
index 565d873..867c3eb 100644
--- a/drivers/staging/ozwpan/ozhcd.c
+++ b/drivers/staging/ozwpan/ozhcd.c
@@ -722,6 +722,8 @@ void *oz_hcd_pd_arrived(void *hpd)
* use for out endpoint 0.
*/
ep = oz_ep_alloc(GFP_ATOMIC, 0);
+ if(!ep)
+ goto out;
spin_lock_bh(&ozhcd->hcd_lock);
if (ozhcd->conn_port >= 0) {
spin_unlock_bh(&ozhcd->hcd_lock);
So do we need to have the below check ?
$ git diff
diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c
index 565d873..867c3eb 100644
--- a/drivers/staging/ozwpan/ozhcd.c
+++ b/drivers/staging/ozwpan/ozhcd.c
@@ -722,6 +722,8 @@ void *oz_hcd_pd_arrived(void *hpd)
* use for out endpoint 0.
*/
ep = oz_ep_alloc(GFP_ATOMIC, 0);
+ if(!ep)
+ goto out;
spin_lock_bh(&ozhcd->hcd_lock);
if (ozhcd->conn_port >= 0) {
spin_unlock_bh(&ozhcd->hcd_lock);