]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
NTFS: Fix invalid pointer dereference in ntfs_mft_record_alloc().
authorAnton Altaparmakov <anton@tuxera.com>
Fri, 28 Jan 2011 20:45:28 +0000 (20:45 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 31 Jan 2011 02:58:11 +0000 (12:58 +1000)
commitaf5eb745efe97d91d2cbe793029838b3311c15da
treec2e410318a3f38928255ebf9ab18332b871e17f0
parent9fbf0c08d441888b977f7c459c8aa57f2c0cb6ad
NTFS: Fix invalid pointer dereference in ntfs_mft_record_alloc().

In ntfs_mft_record_alloc() when mapping the new extent mft record with
map_extent_mft_record() we overwrite @m with the return value and on
error, we then try to use the old @m but that is no longer there as @m
now contains an error code instead so we crash when dereferencing the
error code as if it were a pointer.

The simple fix is to use a temporary variable to store the return value
thus preserving the original @m for later use.  This is a backport from
the commercial Tuxera-NTFS driver and is well tested...

Thanks go to Julia Lawall for pointing this out (whilst I had fixed it
in the commercial driver I had failed to fix it in the Linux kernel).

Signed-off-by: Anton Altaparmakov <anton@tuxera.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Documentation/filesystems/ntfs.txt
fs/ntfs/mft.c