]> git.kernelconcepts.de Git - karo-tx-linux.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)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Mar 2011 19:49:55 +0000 (12:49 -0700)
commit67725123d5df7aace72676b94e1bdffbdbbc0f75
treec1fe22dfd27fa7b3484a3cffa34bf693b722fc6d
parent7713ab22e90f782af5747e738ebb33ea94f67cf0
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>
[ 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