linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] staging: r8188eu: Use GFP_ATOMIC under spin lock
@ 2021-08-10 12:53 Yang Yingliang
  2021-08-10 14:43 ` Dan Carpenter
  2021-08-10 15:15 ` Larry Finger
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Yingliang @ 2021-08-10 12:53 UTC (permalink / raw)
  To: linux-kernel, linux-staging; +Cc: Larry.Finger, phil, gregkh

A spin lock is taken in __nat25_db_network_insert() and
update_BCNTIM() is called under spin lock so we should
use GFP_ATOMIC in both place.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/staging/r8188eu/core/rtw_ap.c     | 2 +-
 drivers/staging/r8188eu/core/rtw_br_ext.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c
index ad37f1f02ee2..0586e4a4cbcb 100644
--- a/drivers/staging/r8188eu/core/rtw_ap.c
+++ b/drivers/staging/r8188eu/core/rtw_ap.c
@@ -98,7 +98,7 @@ static void update_BCNTIM(struct adapter *padapter)
 		}
 
 		if (remainder_ielen > 0) {
-			pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_KERNEL);
+			pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_ATOMIC);
 			if (pbackup_remainder_ie && premainder_ie)
 				memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
 		}
diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index 28f0452d6ccb..e3ff059ce224 100644
--- a/drivers/staging/r8188eu/core/rtw_br_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
@@ -394,7 +394,7 @@ static void __nat25_db_network_insert(struct adapter *priv,
 		}
 		db = db->next_hash;
 	}
-	db = kmalloc(sizeof(*db), GFP_KERNEL);
+	db = kmalloc(sizeof(*db), GFP_ATOMIC);
 	if (!db) {
 		spin_unlock_bh(&priv->br_ext_lock);
 		return;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] staging: r8188eu: Use GFP_ATOMIC under spin lock
  2021-08-10 12:53 [PATCH -next] staging: r8188eu: Use GFP_ATOMIC under spin lock Yang Yingliang
@ 2021-08-10 14:43 ` Dan Carpenter
  2021-08-10 15:15 ` Larry Finger
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-08-10 14:43 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, linux-staging, Larry.Finger, phil, gregkh

On Tue, Aug 10, 2021 at 08:53:14PM +0800, Yang Yingliang wrote:
> A spin lock is taken in __nat25_db_network_insert() and
> update_BCNTIM() is called under spin lock so we should
> use GFP_ATOMIC in both place.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Good spot.  This goes back to the original add a driver commit.  It used
to call rtw_malloc() but that was buggy.

Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] staging: r8188eu: Use GFP_ATOMIC under spin lock
  2021-08-10 12:53 [PATCH -next] staging: r8188eu: Use GFP_ATOMIC under spin lock Yang Yingliang
  2021-08-10 14:43 ` Dan Carpenter
@ 2021-08-10 15:15 ` Larry Finger
  1 sibling, 0 replies; 3+ messages in thread
From: Larry Finger @ 2021-08-10 15:15 UTC (permalink / raw)
  To: Yang Yingliang, linux-kernel, linux-staging; +Cc: phil, gregkh

On 8/10/21 7:53 AM, Yang Yingliang wrote:
> A spin lock is taken in __nat25_db_network_insert() and
> update_BCNTIM() is called under spin lock so we should
> use GFP_ATOMIC in both place.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   drivers/staging/r8188eu/core/rtw_ap.c     | 2 +-
>   drivers/staging/r8188eu/core/rtw_br_ext.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c
> index ad37f1f02ee2..0586e4a4cbcb 100644
> --- a/drivers/staging/r8188eu/core/rtw_ap.c
> +++ b/drivers/staging/r8188eu/core/rtw_ap.c
> @@ -98,7 +98,7 @@ static void update_BCNTIM(struct adapter *padapter)
>   		}
>   
>   		if (remainder_ielen > 0) {
> -			pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_KERNEL);
> +			pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_ATOMIC);
>   			if (pbackup_remainder_ie && premainder_ie)
>   				memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
>   		}
> diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
> index 28f0452d6ccb..e3ff059ce224 100644
> --- a/drivers/staging/r8188eu/core/rtw_br_ext.c
> +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
> @@ -394,7 +394,7 @@ static void __nat25_db_network_insert(struct adapter *priv,
>   		}
>   		db = db->next_hash;
>   	}
> -	db = kmalloc(sizeof(*db), GFP_KERNEL);
> +	db = kmalloc(sizeof(*db), GFP_ATOMIC);
>   	if (!db) {
>   		spin_unlock_bh(&priv->br_ext_lock);
>   		return;
> 

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

Larry


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-10 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 12:53 [PATCH -next] staging: r8188eu: Use GFP_ATOMIC under spin lock Yang Yingliang
2021-08-10 14:43 ` Dan Carpenter
2021-08-10 15:15 ` Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).