public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Tweedie <sct@redhat.com>
To: linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>,
	Al Viro <viro@parcelfarce.linux.theplanet.co.uk>,
	Stephen Tweedie <sct@redhat.com>
Subject: [PATCH] Fix filp being passed through raw ioctl handler
Date: Wed, 18 May 2005 11:22:31 -0400	[thread overview]
Message-ID: <20050518152231.GA15602@devserv.devel.redhat.com> (raw)

[-- Attachment #1: raw-ioctl-filp-001.patch --]
[-- Type: text/plain, Size: 1660 bytes --]

Don't pass meaningless file handles to block device ioctls.

The recent raw IO ioctl-passthrough fix started passing the raw file
handle into the block device ioctl handler.  That's unlikely to be
useful, as the file handle is actually open on a character-mode raw 
device, not a block device, so dereferencing it is not going to yield 
useful results to a block device ioctl handler.

Previously we just passed NULL; also not a value that can usefully
be dereferenced, but at least if it does happen, we'll oops instead of
silently pretending that the file is a block device, so NULL is the more
defensive option here.  This patch reverts to that behaviour.

Noticed by Al Viro.

Signed-off-by: Stephen Tweedie <sct@redhat.com>
Acked-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>

---
commit 844f68d0f8b098a80ccd6802c38daa7db05e00bd
tree 821049ac4ae8c959b67fab0ef8589007d6c8d048
parent ca3b9a7031878ad74f53734caba806a2ece34486
author Stephen Tweedie <sct@redhat.com> Tue, 17 May 2005 18:30:49 +0100
committer Stephen Tweedie <sct@redhat.com> Tue, 17 May 2005 18:30:49 +0100

 char/raw.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: drivers/char/raw.c
===================================================================
--- 9cbd94d6df022eeb8f467da9ad5b7ed2c6843a96/drivers/char/raw.c  (mode:100644)
+++ 821049ac4ae8c959b67fab0ef8589007d6c8d048/drivers/char/raw.c  (mode:100644)
@@ -122,7 +122,7 @@
 {
 	struct block_device *bdev = filp->private_data;
 
-	return blkdev_ioctl(bdev->bd_inode, filp, command, arg);
+	return blkdev_ioctl(bdev->bd_inode, NULL, command, arg);
 }
 
 static void bind_device(struct raw_config_request *rq)

                 reply	other threads:[~2005-05-18 15:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20050518152231.GA15602@devserv.devel.redhat.com \
    --to=sct@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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