]> git.kernelconcepts.de Git - mv-sheeva.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)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 14 Mar 2011 17:14:28 +0000 (10:14 -0700)
commit1eafbfeb7bdf59cfe173304c76188f3fd5f1fd05
treeeae0a7cdf358b1b0396e9c3ec935d0e6be72bdb2
parent2fbfac4e053861925fa3fffcdc327649b09af54c
Fix corrupted OSF partition table parsing

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
[ 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>
fs/partitions/osf.c