]> git.karo-electronics.de Git - karo-tx-linux.git/commit
nilfs2: fix kernel oops in error case of nilfs_ioctl_move_blocks
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Sat, 7 Nov 2009 09:45:16 +0000 (18:45 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 8 Dec 2009 18:20:50 +0000 (10:20 -0800)
commitb88b724607b4e9472398c7b3ebc5f8cb3f1d98d6
treed01a1155ae5549f09059ac042e2498f6f1e6cfce
parent120f68c426e746771e8c09736c0f753822ff3f52
nilfs2: fix kernel oops in error case of nilfs_ioctl_move_blocks

commit 5399dd1fc8f5e812db931225ef5f67d89f3b1a56 upstream.

This fixes a kernel oops reported by Markus Trippelsdorf in the email
titled "[NILFS users] kernel Oops while running nilfs_cleanerd".

The oops was caused by a bug of error path in
nilfs_ioctl_move_blocks() function, which was inlined in
nilfs_ioctl_clean_segments().

nilfs_ioctl_move_blocks checks duplication of blocks which will be
moved in garbage collection.  But, the check should have be done
within nilfs_ioctl_move_inode_block() to prevent list corruption among
buffers storing the target blocks.

To fix the kernel oops, this moves forward the duplication check
before the list insertion.

I also tested this for stable trees [2.6.30, 2.6.31].

Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/nilfs2/ioctl.c