net: cdc_ncm: always reallocate tx_curr_skb when tx_max increases
authorBjørn Mork <bjorn@mork.no>
Fri, 30 May 2014 07:31:04 +0000 (09:31 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 2 Jun 2014 23:01:30 +0000 (16:01 -0700)
commit1ba5d0ff36f765a571c83b55b13ec44f4050fb5b
tree67aa90e05b8c98166c96890bac664b61fdf876f5
parent1e2c611723420789e6098534fc0c57f12ee041b7
net: cdc_ncm: always reallocate tx_curr_skb when tx_max increases

We are calling usbnet_start_xmit() to flush any remaining data,
depending on the side effect that tx_curr_skb is set to NULL,
ensuring a new allocation using the updated tx_max.  But this
side effect will only happen if there were any cached data ready
to transmit. If not, then an empty tx_curr_skb is still allocated
using the old tx_max size. Free it to avoid a buffer overrun.

Fixes: 68864abf08f0 ("net: cdc_ncm: support rx_max/tx_max updates when running")
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/cdc_ncm.c