Re: [RFC PATCH] can: raw: add missing refcount for memory leak fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 4, 2023 at 5:47 PM Oliver Hartkopp <socketcan@xxxxxxxxxxxx> wrote:
>
>
>
> On 04.08.23 14:12, Eric Dumazet wrote:
> > On Fri, Aug 4, 2023 at 1:28 PM Oliver Hartkopp <socketcan@xxxxxxxxxxxx> wrote:
> >>
> >> Commit ee8b94c8510c ("can: raw: fix receiver memory leak") introduced
> >> a new reference to the CAN netdevice that has assigned CAN filters.
> >> But this new ro->dev reference did not maintain its own refcount which
> >> lead to another KASAN use-after-free splat found by Eric Dumazet.
> >>
> >> This patch ensures a proper refcount for the CAN nedevice.
> >
> > Hi Olivier
> >
> > I would feel a bit safer with new longterm device references if you
> > could add an ro->dev_tracker and use netdev_put() netdev_hold() and
> > friends ;)
> >
> > Thanks !
> >
>
> Hi Eric,
>
> the netdev_hold() mechanic has been introduced in Linux 6.0.
>
> Would it make sense to take this patch as fix for all the current stable
> kernels and move to the dev-tracker as improvement via net-next as usual?

Good question.

My take on this, but others might disagree :

I think it is better to cook a patch for current upstream kernels.

Then we will adapt it when backporting to old ones, it should be
relatively easy.




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux