Re: [PATCH -next] staging: r8188eu: Use GFP_ATOMIC under spin lock

Larry Finger
2021-08-10T15:15:48Z

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