x86, kmmio/mmiotrace: Fix double free of kmmio_fault_pages
commit97537a758d5d29534ec0b280403c182fe5155ee5
authorMarcin Slusarz <marcin.slusarz@gmail.com>
Sun, 13 Jun 2010 21:56:54 +0000 (13 23:56 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 13 Aug 2010 20:30:38 +0000 (13 13:30 -0700)
tree921cb11478ab453d661c6459a58bbf45e9d1326a
parentafaac2588bac3673e5e1c6b73fc054c931535175
x86, kmmio/mmiotrace: Fix double free of kmmio_fault_pages

commit 8b8f79b927b6b302bb65fb8c56e7a19be5fbdbef upstream.

After every iounmap mmiotrace has to free kmmio_fault_pages, but
it can't do it directly, so it defers freeing by RCU.

It usually works, but when mmiotraced code calls ioremap-iounmap
multiple times without sleeping between (so RCU won't kick in
and start freeing) it can be given the same virtual address, so
at every iounmap mmiotrace will schedule the same pages for
release. Obviously it will explode on second free.

Fix it by marking kmmio_fault_pages which are scheduled for
release and not adding them second time.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Tested-by: Marcin Kocielnicki <koriakin@0x04.net>
Tested-by: Shinpei KATO <shinpei@il.is.s.u-tokyo.ac.jp>
Acked-by: Pekka Paalanen <pq@iki.fi>
Cc: Stuart Bennett <stuart@freedesktop.org>
Cc: Marcin Kocielnicki <koriakin@0x04.net>
Cc: nouveau@lists.freedesktop.org
LKML-Reference: <20100613215654.GA3829@joi.lan>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/mm/kmmio.c
arch/x86/mm/testmmiotrace.c