lkml.org 
[lkml]   [2015]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: use-after-free in sixpack_close
On Thu, 17 Dec 2015 16:05:32 -0500 (EST)
David Miller <davem@davemloft.net> wrote:

> From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
> Date: Thu, 17 Dec 2015 11:41:04 +0000
>
> >> 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


\
 
 \ /
  Last update: 2015-12-18 01:41    [W:0.077 / U:0.640 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site