netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pkshih <pkshih@realtek.com>
To: "kjlu@umn.edu" <kjlu@umn.edu>
Cc: "mingo@kernel.org" <mingo@kernel.org>,
	"Larry.Finger@lwfinger.net" <Larry.Finger@lwfinger.net>,
	"rdunlap@infradead.org" <rdunlap@infradead.org>,
	"pakki001@umn.edu" <pakki001@umn.edu>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"kvalo@codeaurora.org" <kvalo@codeaurora.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] net: rtl8192c: fix a potential NULL pointer dereference
Date: Tue, 12 Mar 2019 09:03:41 +0000	[thread overview]
Message-ID: <1552381414.27421.2.camel@realtek.com> (raw)
In-Reply-To: <20190312075948.1569-1-kjlu@umn.edu>

On Tue, 2019-03-12 at 02:59 -0500, Kangjie Lu wrote:
> In case dev_alloc_skb fails, the fix safely returns to avoid
> potential NULL pointer dereference.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
>  drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
> b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
> index 18c76990a089..9042fc044c7e 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
> @@ -623,6 +623,9 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
>  		      u1rsvdpageloc, 3);
>  
>  	skb = dev_alloc_skb(totalpacketlen);
> +	if (!skb)
> +		return;
> +
>  	skb_put_data(skb, &reserved_page_packet, totalpacketlen);
>  
>  	if (cmd_send_packet)

The subject prefix should be 'rtlwifi: ...'.

Your fix is ok, but I would like to fix all failed cases of dev_alloc_skb().
I will send another patch to fix all of them.

Thanks
PK


      reply	other threads:[~2019-03-12  9:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12  7:59 [PATCH] net: rtl8192c: fix a potential NULL pointer dereference Kangjie Lu
2019-03-12  9:03 ` Pkshih [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=1552381414.27421.2.camel@realtek.com \
    --to=pkshih@realtek.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=kjlu@umn.edu \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pakki001@umn.edu \
    --cc=rdunlap@infradead.org \
    /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).