Skip to contentSkip to conversation

initrd unmount problem

PATCH New Go Taniguchi 1 participant 1 message May 28, 2001 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initrd unmount problem

Hi,

It seems that ioctl_by_bdev() in fs/block_dev.c has a problem. When initrd is unmounted it can cause OOPS.
This problem occurs in recent ac patches.
May be vanilla too.

change_root() in fs/super.c calls ioctl_by_bdev() in fs/block_dev.c which does not set inode_fake.i_bdev.

But ioctl of ramdisk (rd_ioctl() in rd.c) accesses to i_bdev->bd_openers of the inode and which causes OOPS.

I attach the patch.

- GO!

fs/block_dev.c renamed from fs/block_dev.c.orig +1 -0
@@ -602,6 +602,7 @@
 	if (!bdev->bd_op->ioctl)
 		return -EINVAL;
 	inode_fake.i_rdev=rdev;
+	inode_fake.i_bdev=bdev;
 	init_waitqueue_head(&inode_fake.i_wait);
 	set_fs(KERNEL_DS);
 	res = bdev->bd_op->ioctl(&inode_fake, NULL, cmd, arg);