staging: r8188eu: Fix a couple scheduling in atomic bugs
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 12 Aug 2021 06:57:10 +0000 (09:57 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Aug 2021 08:28:25 +0000 (10:28 +0200)
These allocations are sometimes done while holding a spin_lock so they
have to be atomic.  The call tree looks like this:

-> rtw_set_802_11_connect() <- takes a spin_lock
   -> rtw_do_join()
      -> rtw_sitesurvey_cmd()  <-- does a GFP_ATOMIC allocation
         -> p2p_ps_wk_cmd()

Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20210812065710.GA31863@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_p2p.c

index 3a05e19..1c2c619 100644 (file)
@@ -1697,13 +1697,13 @@ u8 p2p_ps_wk_cmd(struct adapter *padapter, u8 p2p_ps_state, u8 enqueue)
                return res;
 
        if (enqueue) {
-               ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
+               ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
                if (!ph2c) {
                        res = _FAIL;
                        goto exit;
                }
 
-               pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL);
+               pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
                if (!pdrvextra_cmd_parm) {
                        kfree(ph2c);
                        res = _FAIL;