handling oz_ep_alloc() failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]