Thread (7 messages) 7 messages, 4 authors, 2015-12-18

Re: use-after-free in sixpack_close

From: One Thousand Gnomes <hidden>
Date: 2015-12-17 23:48:07
Also in: linux-hams, lkml

On Thu, 17 Dec 2015 16:05:32 -0500 (EST)
David Miller [off-list ref] wrote:
From: One Thousand Gnomes <redacted>
Date: Thu, 17 Dec 2015 11:41:04 +0000
quoted
quoted
This report is then followed by a dozen of other use-after-free reports.

On commit edb42dc7bc0da0125ceacab810a553ce1f0cac8d (Dec 15).

Thank you
sixpack_close does unregister_netdev(sp->dev), which frees sp as sp is
actually allocated via alloc_netdev()

Then deletes two timers within sp

Then frees two buffers indexed off sp
This should fix it, the only thing I'm unsure of is if we should perhaps
also use del_timer_sync() here.  Anyone?
I think you need to yes as the timers use the data you wil be freeing in
the unregister.

Also you are at the point the tty is closing so the net device may be
active. Don't you need to netif_stop_queue() or defer the buffer
kfrees until after the network device is unregistered so you don't pee
into free memory if you have a transmit occurring ?

Alan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help