iwlwifi: fix potential rx buffer loss
commita8d37f2ebd5ef08a169ecf7c7fb52c2ef4037cec
authorReinette Chatre <reinette.chatre@intel.com>
Fri, 11 Sep 2009 17:38:12 +0000 (11 10:38 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Nov 2009 00:23:09 +0000 (9 16:23 -0800)
tree5d336b4a1bc2415d988b59da61015db5e8e768ec
parent49fae454bb8ca92b5ff999cc823ac60caf2ccb61
iwlwifi: fix potential rx buffer loss

commit de0bd50845eb5935ce3d503c5d2f565d6cb9ece1 upstream.

RX handling maintains a few lists that keep track of the RX buffers.
Buffers move from one list to the other as they are used, replenished, and
again made available for usage. In one such instance, when a buffer is used
it enters the "rx_used" list. When buffers are replenished an skb is
attached to the buffer and it is moved to the "rx_free" list. The problem
here is that the buffer is first removed from the "rx_used" list _before_ the
skb is allocated. Thus, if the skb allocation fails this buffer remains
removed from the "rx_used" list and is thus lost for future usage.

Fix this by first allocating the skb before trying to attach it to a list.
We add an additional check to not do this unnecessarily.

Reported-by: Rick Farrington <rickdic@hotmail.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/wireless/iwlwifi/iwl-rx.c
drivers/net/wireless/iwlwifi/iwl3945-base.c