public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@mandrakesoft.com>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix for initrd panic in 2.4.5
Date: 06 Jun 2001 18:03:32 +0200	[thread overview]
Message-ID: <m266e9wq7f.fsf@trasno.mitica> (raw)
In-Reply-To: <200106060408.AAA03634@localhost.localdomain>
In-Reply-To: <200106060408.AAA03634@localhost.localdomain>

>>>>> "james" == James Bottomley <James.Bottomley@SteelEye.com> writes:

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

see the fix in ac kernels,  you have a bdev there to put in the
fake_inode.

Later, Juan.


james> Index: fs/block_dev.c
james> ===================================================================
james> RCS file: /home/jejb/CVSROOT/linux/2.4/fs/block_dev.c,v
james> retrieving revision 1.1.1.10
james> diff -u -r1.1.1.10 block_dev.c
james> --- fs/block_dev.c	2001/05/26 15:33:37	1.1.1.10
james> +++ fs/block_dev.c	2001/06/02 13:14:35
james> @@ -596,13 +596,14 @@
james> int ioctl_by_bdev(struct block_device *bdev, unsigned cmd, unsigned long arg)
james> {
james> kdev_t rdev = to_kdev_t(bdev->bd_dev);
james> -	struct inode inode_fake;
james> +	struct inode inode_fake = { 0 };
james> int res;
james> mm_segment_t old_fs = get_fs();
 
james> if (!bdev->bd_op->ioctl)
james> return -EINVAL;
james> inode_fake.i_rdev=rdev;
james> +	inode_fake.i_bdev = bdev;
james> init_waitqueue_head(&inode_fake.i_wait);
james> set_fs(KERNEL_DS);
james> res = bdev->bd_op->ioctl(&inode_fake, NULL, cmd, arg);

-- 
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy

      reply	other threads:[~2001-06-06 16:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-06  4:08 [PATCH] fix for initrd panic in 2.4.5 James Bottomley
2001-06-06 16:03 ` Juan Quintela [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m266e9wq7f.fsf@trasno.mitica \
    --to=quintela@mandrakesoft.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox