All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Tobias Klauser <tklauser@distanz.ch>
Cc: Kalle Valo <kvalo@codeaurora.org>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] rtl8xxxu: Check return value of kmemdup()
Date: Tue, 12 Jan 2016 18:34:05 -0500	[thread overview]
Message-ID: <wrfjk2ne1ifm.fsf@redhat.com> (raw)
In-Reply-To: <1452601604-11309-1-git-send-email-tklauser@distanz.ch> (Tobias Klauser's message of "Tue, 12 Jan 2016 13:26:44 +0100")

Tobias Klauser <tklauser@distanz.ch> writes:
> In rtl8xxxu_load_firmware() check the return value of kmemdup() and
> error out with -ENOMEM in case of NULL to prevent a NULL pointer
> dereference.
>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> ---
>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 4 ++++
>  1 file changed, 4 insertions(+)

Thanks, I'll add it to my queue!

Jes

>
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
> index 7d820c395375..59f70513c491 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
> @@ -2174,6 +2174,10 @@ static int rtl8xxxu_load_firmware(struct rtl8xxxu_priv *priv, char *fw_name)
>  	}
>  
>  	priv->fw_data = kmemdup(fw->data, fw->size, GFP_KERNEL);
> +	if (!priv->fw_data) {
> +		ret = -ENOMEM;
> +		goto exit;
> +	}
>  	priv->fw_size = fw->size - sizeof(struct rtl8xxxu_firmware_header);
>  
>  	signature = le16_to_cpu(priv->fw_data->signature);

      reply	other threads:[~2016-01-12 23:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12 12:26 [PATCH] rtl8xxxu: Check return value of kmemdup() Tobias Klauser
2016-01-12 23:34 ` Jes Sorensen [this message]

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=wrfjk2ne1ifm.fsf@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=tklauser@distanz.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.