netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: James Morris <jmorris@intercode.com.au>
Cc: Matthew Wilcox <willy@debian.org>,
	kuznet@ms2.inr.ac.ru, davem@redhat.com, netdev@oss.sgi.com
Subject: Re: [PATCH] minor socket ioctl cleanup for 2.5.30
Date: Thu, 8 Aug 2002 18:42:06 +0100	[thread overview]
Message-ID: <20020808184206.Q24631@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <Mutt.LNX.4.44.0208090320010.20027-100000@blackbird.intercode.com.au>; from jmorris@intercode.com.au on Fri, Aug 09, 2002 at 03:26:10AM +1000

On Fri, Aug 09, 2002 at 03:26:10AM +1000, James Morris wrote:
> Yes, this patch is complete (see below), but is waiting on another fix to
> go in (which I sent you recently).  The unification of the ioctl code also
> now means SIOCSPGRP works exactly the same as F_SETOWN (i.e. it also works
> now for sigio).

this patch is for information purposes only, right?  ;-)

> diff -urN -X dontdiff linux-2.5.27.orig/fs/fcntl.c linux-2.5.27.w1/fs/fcntl.c
> --- linux-2.5.27.orig/fs/fcntl.c	Sun Jul 21 10:57:51 2002
> +++ linux-2.5.27.w1/fs/fcntl.c	Sun Jul 28 18:23:03 2002
> @@ -259,6 +259,18 @@
>  	return 0;
>  }
>  
> +long f_getown(struct file *filp)
> +{
> +	return filp->f_owner.pid;
> +}

i still think this function shouldn't exist -- a direct reference is
no problem.

>  		case F_SETOWN:
> -			lock_kernel();
> -			filp->f_owner.pid = arg;
> -			filp->f_owner.uid = current->uid;
> -			filp->f_owner.euid = current->euid;
>  			err = 0;
> -			if (S_ISSOCK (filp->f_dentry->d_inode->i_mode))
> -				err = sock_fcntl (filp, F_SETOWN, arg);
> +			lock_kernel();
> +			f_setown(filp, arg);
>  			unlock_kernel();

this is now hooked by the LSM folks so patch will need to be updated for
2.5.30.

> diff -urN -X dontdiff linux-2.5.27.orig/net/socket.c linux-2.5.27.w1/net/socket.c
> --- linux-2.5.27.orig/net/socket.c	Sat Jul  6 11:01:02 2002
> +++ linux-2.5.27.w1/net/socket.c	Sun Jul 28 22:08:37 2002
> +	switch(cmd) {
> +	case FIOSETOWN:
> +	case SIOCSPGRP:
> +		if (get_user(pid, (int *)arg))
> +			err = -EFAULT;
> +		else
> +			f_setown(sock->file, pid);
> +		break;

i'm pretty sure you need a lock_kernel + unlock_kernel around the else.
if two people are doing a F_SETOWN / SIOCSPGRP at the same time, you could
have a race.

-- 
Revolutions do not require corporate support.

  reply	other threads:[~2002-08-08 17:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-08  0:24 [PATCH] minor socket ioctl cleanup for 2.5.30 James Morris
2002-08-08 15:33 ` David S. Miller
2002-08-08 16:07   ` Matthew Wilcox
2002-08-08 17:13     ` kuznet
2002-08-08 17:17       ` Matthew Wilcox
2002-08-08 17:26         ` James Morris
2002-08-08 17:42           ` Matthew Wilcox [this message]
2002-08-08 17:46             ` James Morris

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=20020808184206.Q24631@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=davem@redhat.com \
    --cc=jmorris@intercode.com.au \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@oss.sgi.com \
    /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;
as well as URLs for NNTP newsgroup(s).