]> rtime.felk.cvut.cz Git - linux-imx.git/commit
Fix corrupted OSF partition table parsing
authorTimo Warns <Warns@pre-sense.de>
Mon, 14 Mar 2011 13:59:33 +0000 (14:59 +0100)
committerAndi Kleen <ak@linux.intel.com>
Mon, 1 Aug 2011 20:54:45 +0000 (13:54 -0700)
commit5b1157fecf0ced4dd3c447866c332a6d9f9979ec
treeb4b5508cf524d1932269dc879755d15e0b26e31c
parent36a01162f9a6d45d87ffe118f72ec9bc9853acdf
Fix corrupted OSF partition table parsing

commit 1eafbfeb7bdf59cfe173304c76188f3fd5f1fd05 upstream.

The kernel automatically evaluates partition tables of storage devices.
The code for evaluating OSF partitions contains a bug that leaks data
from kernel heap memory to userspace for certain corrupted OSF
partitions.

In more detail:

  for (i = 0 ; i < le16_to_cpu(label->d_npartitions); i++, partition++) {

iterates from 0 to d_npartitions - 1, where d_npartitions is read from
the partition table without validation and partition is a pointer to an
array of at most 8 d_partitions.

Add the proper and obvious validation.

Signed-off-by: Timo Warns <warns@pre-sense.de>
Cc: stable@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
[ Changed the patch trivially to not repeat the whole le16_to_cpu()
  thing, and to use an explicit constant for the magic value '8' ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/partitions/osf.c