All of lore.kernel.org
 help / color / mirror / Atom feed
* re: wl12xx: support up to 8 stations in AP-mode
@ 2011-09-21  7:05 Dan Carpenter
  2011-09-21  7:25 ` Luciano Coelho
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2011-09-21  7:05 UTC (permalink / raw)
  To: Arik Nemtsov; +Cc: Luciano Coelho, John W. Linville, linux-wireless

Hi Arik,

Smatch complains about c47e8229fa56 "wl12xx: support up to 8 stations
in AP-mode"

drivers/net/wireless/wl12xx/main.c +832 wl12xx_irq_update_links_status(22)
	error: buffer overflow 'status->tx_lnk_free_pkts' 8 <= 10

   828          for (hlid = WL1271_AP_STA_HLID_START; hlid < AP_MAX_LINKS; hlid++) {
                                                             ^^^^^^^^^^^^
We increased this to 11.

   829                  if (!wl1271_is_active_sta(wl, hlid))
   830                          continue;
   831  
   832                  cnt = status->tx_lnk_free_pkts[hlid] -
                                      ^^^^^^^^^^^^^^^^^^^^^^

But the ->tx_lnk_free_pkts[] array still only has 8 elements so we're
reading past the end of the array.

   833                        wl->links[hlid].prev_freed_pkts;
   834  
   835                  wl->links[hlid].prev_freed_pkts =
   836                          status->tx_lnk_free_pkts[hlid];
   837                  wl->links[hlid].allocated_pkts -= cnt;
   838  
   839                  wl12xx_irq_ps_regulate_link(wl, hlid,
   840                                              wl->links[hlid].allocated_pkts);
   841          }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* re: wl12xx: support up to 8 stations in AP-mode
  2011-09-21  7:05 wl12xx: support up to 8 stations in AP-mode Dan Carpenter
@ 2011-09-21  7:25 ` Luciano Coelho
  2011-09-22  5:29   ` Arik Nemtsov
  0 siblings, 1 reply; 3+ messages in thread
From: Luciano Coelho @ 2011-09-21  7:25 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Arik Nemtsov, John W. Linville, linux-wireless

On Wed, 2011-09-21 at 00:05 -0700, Dan Carpenter wrote: 
> Hi Arik,
> 
> Smatch complains about c47e8229fa56 "wl12xx: support up to 8 stations
> in AP-mode"
> 
> drivers/net/wireless/wl12xx/main.c +832 wl12xx_irq_update_links_status(22)
> 	error: buffer overflow 'status->tx_lnk_free_pkts' 8 <= 10
> 
>    828          for (hlid = WL1271_AP_STA_HLID_START; hlid < AP_MAX_LINKS; hlid++) {
>                                                              ^^^^^^^^^^^^
> We increased this to 11.
> 
>    829                  if (!wl1271_is_active_sta(wl, hlid))
>    830                          continue;
>    831  
>    832                  cnt = status->tx_lnk_free_pkts[hlid] -
>                                       ^^^^^^^^^^^^^^^^^^^^^^
> 
> But the ->tx_lnk_free_pkts[] array still only has 8 elements so we're
> reading past the end of the array.
> 
>    833                        wl->links[hlid].prev_freed_pkts;
>    834  
>    835                  wl->links[hlid].prev_freed_pkts =
>    836                          status->tx_lnk_free_pkts[hlid];
>    837                  wl->links[hlid].allocated_pkts -= cnt;
>    838  
>    839                  wl12xx_irq_ps_regulate_link(wl, hlid,
>    840                                              wl->links[hlid].allocated_pkts);
>    841          }

Good catch, Dan! Thanks for checking this.

I checked our new firmware API and it seems that the wl12xx_fw_status
structure has changed.  Now, WL12XX_MAX_LINKS, should be 12 instead of
8.

Arik, can you verify this and send a fix patch?


-- 
Cheers,
Luca.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: wl12xx: support up to 8 stations in AP-mode
  2011-09-21  7:25 ` Luciano Coelho
@ 2011-09-22  5:29   ` Arik Nemtsov
  0 siblings, 0 replies; 3+ messages in thread
From: Arik Nemtsov @ 2011-09-22  5:29 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Luciano Coelho, John W. Linville, linux-wireless

On Wed, Sep 21, 2011 at 10:25, Luciano Coelho <coelho@ti.com> wrote:
> On Wed, 2011-09-21 at 00:05 -0700, Dan Carpenter wrote:
>> Hi Arik,
>>
>> Smatch complains about c47e8229fa56 "wl12xx: support up to 8 stations
>> in AP-mode"
>>
>> drivers/net/wireless/wl12xx/main.c +832 wl12xx_irq_update_links_status(22)
>>       error: buffer overflow 'status->tx_lnk_free_pkts' 8 <= 10
>>
>>    828          for (hlid = WL1271_AP_STA_HLID_START; hlid < AP_MAX_LINKS; hlid++) {
>>                                                              ^^^^^^^^^^^^

Again, good catch there Dan. We'll verify the fix internally before
releasing it (as it changes the host-fw interface).
I'll also add a BUILD_BUG_ON so this won't happen again.

Arik

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-22  5:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-21  7:05 wl12xx: support up to 8 stations in AP-mode Dan Carpenter
2011-09-21  7:25 ` Luciano Coelho
2011-09-22  5:29   ` Arik Nemtsov

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.