All of lore.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] Staging: rtl8192u: fix some memory corruption
Date: Tue, 17 Apr 2012 17:46:01 +0000	[thread overview]
Message-ID: <4F8DAC59.4050401@lwfinger.net> (raw)
In-Reply-To: <20120417064542.GG26756@elgon.mountain>

On 04/17/2012 01:45 AM, Dan Carpenter wrote:
> When we recieved a command we incremented a stat counter depending on
> the type of message.  The problem is there were 8 types of commands but
> there were only 4 counters allocated so it corrupted memory past the
> end of the rxcmdpkt[] array.
>
> The fix is just to remove the counters because they aren't used.
>
> Signed-off-by: Dan Carpenter<dan.carpenter@oracle.com>
> ---
> I don't think the layout of the stats struct matters, but I don't have
> the hardware to test this.

I don't have the hardware either, but in all of the Realtek-based drivers the 
only structs that require strict layout are the RX and TX descriptors. This 
change should be benign. I doubt that the code relies on the corruption of the 
overrun.

You have a typo in the commit message. After you fix that, then

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

>
> diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h
> index 9b81f26..43d459d 100644
> --- a/drivers/staging/rtl8192u/r8192U.h
> +++ b/drivers/staging/rtl8192u/r8192U.h
> @@ -610,7 +610,6 @@ typedef struct Stats
>   //	unsigned long rxnopointer;
>   	unsigned long rxok;
>   	unsigned long rxframgment;
> -	unsigned long rxcmdpkt[4];		//08/05/08 amy rx cmd element txfeedback/bcn report/cfg set/query
>   	unsigned long rxurberr;
>   	unsigned long rxstaterr;
>   	unsigned long received_rate_histogram[4][32];	//0: Total, 1:OK, 2:CRC, 3:ICV, 2007 07 03 cosa
> diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
> index 0cb28c7..9348f42 100644
> --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c
> +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
> @@ -697,7 +697,6 @@ cmpk_message_handle_rx(
>   	struct ieee80211_rx_stats *pstats)
>   {
>   //	u32			debug_level = DBG_LOUD;
> -	struct r8192_priv *priv = ieee80211_priv(dev);
>   	int			total_length;
>   	u8			cmd_length, exe_cnt = 0;
>   	u8			element_id;
> @@ -779,9 +778,6 @@ cmpk_message_handle_rx(
>   		// 2007/01/22 MH Add to display tx statistic.
>   		//cmpk_DisplayTxStatistic(pAdapter);
>
> -		/* 2007/03/09 MH Collect sidderent cmd element pkt num. */
> -		priv->stats.rxcmdpkt[element_id]++;
> -
>   		total_length -= cmd_length;
>   		pcmd_buff    += cmd_length;
>   	}	/* while (total_length>  0) */
>


      reply	other threads:[~2012-04-17 17:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-17  6:45 [patch] Staging: rtl8192u: fix some memory corruption Dan Carpenter
2012-04-17 17:46 ` Larry Finger [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=4F8DAC59.4050401@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=kernel-janitors@vger.kernel.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 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.