linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Ivan Safonov <insafonov@gmail.com>
Cc: "Larry Finger" <Larry.Finger@lwfinger.net>,
	devel@driverdev.osuosl.org,
	"Robert Węcławski" <r.weclawski@gmail.com>,
	"Florian Büstgens" <flbue@gmx.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	"Nishka Dasgupta" <nishkadg.linux@gmail.com>
Subject: Re: [PATCH] staging: r8188eu: replace rtw_malloc() with it's definition
Date: Tue, 10 Sep 2019 14:59:32 +0300	[thread overview]
Message-ID: <20190910115932.GB15977@kadam> (raw)
In-Reply-To: <20190908090026.2656-1-insafonov@gmail.com>

On Sun, Sep 08, 2019 at 12:00:26PM +0300, Ivan Safonov wrote:
> rtw_malloc prevents the use of kmemdup/kzalloc and others.
> 
> Signed-off-by: Ivan Safonov <insafonov@gmail.com>
> ---
>  drivers/staging/rtl8188eu/core/rtw_ap.c        |  4 ++--
>  drivers/staging/rtl8188eu/core/rtw_mlme_ext.c  |  2 +-
>  .../staging/rtl8188eu/include/osdep_service.h  |  3 ---
>  drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 18 +++++++++---------
>  drivers/staging/rtl8188eu/os_dep/mlme_linux.c  |  2 +-
>  .../staging/rtl8188eu/os_dep/osdep_service.c   |  7 +------
>  6 files changed, 14 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c
> index 51a5b71f8c25..c9c57379b7a2 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_ap.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
> @@ -104,7 +104,7 @@ static void update_BCNTIM(struct adapter *padapter)
>  	}
>  
>  	if (remainder_ielen > 0) {
> -		pbackup_remainder_ie = rtw_malloc(remainder_ielen);
> +		pbackup_remainder_ie = kmalloc(remainder_ielen, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
                                                                ^^^^^^^^^^^^^
This stuff isn't right.  It really should be checking if spinlocks are
held or IRQs are disabled.  And the only way to do that is by auditing
the callers.

(The original rtw_malloc() implementation is buggy nonsense).

regards,
dan carpenter


  reply	other threads:[~2019-09-10 11:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-08  9:00 [PATCH] staging: r8188eu: replace rtw_malloc() with it's definition Ivan Safonov
2019-09-10 11:59 ` Dan Carpenter [this message]
2019-09-14 15:18   ` Ivan Safonov
2019-09-14 19:52     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190910115932.GB15977@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=flbue@gmx.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=insafonov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nishkadg.linux@gmail.com \
    --cc=r.weclawski@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).