public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix for initrd panic in 2.4.5
@ 2001-06-06  4:08 James Bottomley
  2001-06-06 16:03 ` Juan Quintela
  0 siblings, 1 reply; 2+ messages in thread
From: James Bottomley @ 2001-06-06  4:08 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

Not many people have seen this, but the i_bdev field in fake_inode in 
ioctl_by_bdev() is uninitialised.  Since this field is dereferenced by 
BLKFLSBUF in rd_ioctl, it can lead to a panic (depending on what happens to be 
on the stack).  The attached fixes the problem and clears all the fields in 
fake_inode to make any other problems like this show up.

James Bottomley


[-- Attachment #2: linux-2.4.5-initrd.diff --]
[-- Type: text/plain , Size: 768 bytes --]

Index: fs/block_dev.c
===================================================================
RCS file: /home/jejb/CVSROOT/linux/2.4/fs/block_dev.c,v
retrieving revision 1.1.1.10
diff -u -r1.1.1.10 block_dev.c
--- fs/block_dev.c	2001/05/26 15:33:37	1.1.1.10
+++ fs/block_dev.c	2001/06/02 13:14:35
@@ -596,13 +596,14 @@
 int ioctl_by_bdev(struct block_device *bdev, unsigned cmd, unsigned long arg)
 {
 	kdev_t rdev = to_kdev_t(bdev->bd_dev);
-	struct inode inode_fake;
+	struct inode inode_fake = { 0 };
 	int res;
 	mm_segment_t old_fs = get_fs();
 
 	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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-06-06 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-06  4:08 [PATCH] fix for initrd panic in 2.4.5 James Bottomley
2001-06-06 16:03 ` Juan Quintela

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox