Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1512101

Re: [PATCH] ppdev: fix double-free of pp->pdev->name

From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: [PATCH] ppdev: fix double-free of pp->pdev->name
Date 2016-10-30 17:30 +0100
Message-ID <sy19D-71j-7@gated-at.bofh.it> (permalink)
References <sy0wW-6uk-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Oct 30, 2016 at 8:44 AM, Jann Horn <jann@thejh.net> wrote:
> free_pardevice() is called by parport_unregister_device() and already frees
> pp->pdev->name, don't try to do it again.
>
> This bug causes kernel crashes.
>
> I found and verified this with KASAN and some added pr_emerg()s:
>
> [   60.316568] pp_release: pp->pdev->name == ffff88039cb264c0
> [   60.316692] free_pardevice: freeing par_dev->name at ffff88039cb264c0
> [   60.316706] pp_release: kfree(ffff88039cb264c0)
> [   60.316714] ==========================================================
> [   60.316722] BUG: Double free or freeing an invalid pointer
> [   60.316731] Unexpected shadow byte: 0xFB
> [   60.316801] Object at ffff88039cb264c0, in cache kmalloc-32 size: 32
> [   60.316813] Allocated:
> [   60.316824] PID = 1695
> [   60.316869] Freed:
> [   60.316880] PID = 1695
> [   60.316935] ==========================================================
>
> CCing Andy Lutomirski because I think this is what broke vmapped stacks
> for me - after applying this patch, vmapped stacks worked for me.
> Previously, I got oopses (and lockups) caused by area->pages[0] being
> 0x400000000 in __vunmap(), with area->pages being allocated in the kmalloc
> area.

That's an odd symptom.  I assume that what's happening is that the
pages array is being freed early by the extra kfree in here and then
getting corrupted.

--Andy

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] ppdev: fix double-free of pp->pdev->name Jann Horn <jann@thejh.net> - 2016-10-30 16:50 +0100
  Re: [PATCH] ppdev: fix double-free of pp->pdev->name Andy Lutomirski <luto@amacapital.net> - 2016-10-30 17:30 +0100
    Re: [PATCH] ppdev: fix double-free of pp->pdev->name Jann Horn <jann@thejh.net> - 2016-10-30 17:50 +0100
  Re: [PATCH] ppdev: fix double-free of pp->pdev->name Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-10-30 19:00 +0100
    Re: [PATCH] ppdev: fix double-free of pp->pdev->name Jann Horn <jann@thejh.net> - 2016-10-30 19:10 +0100
      Re: [PATCH] ppdev: fix double-free of pp->pdev->name Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-30 23:20 +0100

csiph-web