xen: fix grant table bug
commitbbc60c18ed17df75270da504bbd8f7bc4a52d43d
authorMichael Abd-El-Malek <mabdelmalek@cmu.edu>
Fri, 4 Apr 2008 09:33:48 +0000 (4 02:33 -0700)
committerIngo Molnar <mingo@elte.hu>
Fri, 4 Apr 2008 16:36:46 +0000 (4 18:36 +0200)
treeb8cd0cc51cf9bfb96f99ad58038b7489ae5b7c9c
parentbae1d2507e44417455eda76d4435352fee14cf51
xen: fix grant table bug

fix memory corruption and crash due to mis-sized grant table.

A PV OS has two grant table data structures: the grant table itself
and a free list.  The free list is composed of an array of pages,
which grow dynamically as the guest OS requires more grants.  While
the grant table contains 8-byte entries, the free list contains 4-byte
entries.  So we have half as many pages in the free list than in the
grant table.

There was a bug in the free list allocation code. The free list was
indexed as if it was the same size as the grant table.  But it's only
half as large.  So memory got corrupted, and I was seeing crashes in
the slab allocator later on.

Taken from:

  http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/4018c0da3360

Signed-off-by: Michael Abd-El-Malek <mabdelmalek@cmu.edu>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
drivers/xen/grant-table.c