public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] -EINVAL if no fasync op for file
@ 2007-10-18  9:35 Dmitry Antipov
  2007-10-26 20:24 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Antipov @ 2007-10-18  9:35 UTC (permalink / raw)
  To: linux-kernel

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

This patch proposes an additional error checking performed within setfl().

As a result, fcntl (fd, F_SETFL, O_ASYNC) will return -1 and set errno
to -EINVAL if filp->f_op->fasync is NULL for file specified by fd. This
is possible, for example, if fd is a descriptor returned by inotify_init().


Dmitry


[-- Attachment #2: 2.6.23-fcntl-fasync-check.patch --]
[-- Type: text/x-patch, Size: 352 bytes --]

Signed-off-by: Dmitry Antipov <antipov@dev.rtsoft.ru>

--- .orig-2.6.23/fs/fcntl.c	2007-10-17 15:26:06.000000000 +0400
+++ 2.6.23/fs/fcntl.c	2007-10-17 15:25:27.000000000 +0400
@@ -240,6 +240,9 @@
 			error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0);
 			if (error < 0)
 				goto out;
+		} else {
+			error = -EINVAL;
+			goto out;
 		}
 	}
 

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

* Re: [PATCH] -EINVAL if no fasync op for file
  2007-10-18  9:35 [PATCH] -EINVAL if no fasync op for file Dmitry Antipov
@ 2007-10-26 20:24 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2007-10-26 20:24 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: linux-kernel

On Thu, 18 Oct 2007 13:35:51 +0400
Dmitry Antipov <antipov@dev.rtsoft.ru> wrote:

> This patch proposes an additional error checking performed within setfl().
> 
> As a result, fcntl (fd, F_SETFL, O_ASYNC) will return -1 and set errno
> to -EINVAL if filp->f_op->fasync is NULL for file specified by fd. This
> is possible, for example, if fd is a descriptor returned by inotify_init().
> 
> 
> Dmitry
> 
> 
> 
> [2.6.23-fcntl-fasync-check.patch  text/x-patch (353B)]
> Signed-off-by: Dmitry Antipov <antipov@dev.rtsoft.ru>
> 
> --- .orig-2.6.23/fs/fcntl.c	2007-10-17 15:26:06.000000000 +0400
> +++ 2.6.23/fs/fcntl.c	2007-10-17 15:25:27.000000000 +0400
> @@ -240,6 +240,9 @@
>  			error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0);
>  			if (error < 0)
>  				goto out;
> +		} else {
> +			error = -EINVAL;
> +			goto out;
>  		}
>  	}

This would have made sense whent he code was originally written
but it now has a (small) potential to break existing applications.

I guess if the _only_ fd's which don't implement fasync are inotify,
signalfd and other such new-and-obscure things then the risk is
probably acceptably low.

But is the proposed change actually very useful?

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

end of thread, other threads:[~2007-10-26 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-18  9:35 [PATCH] -EINVAL if no fasync op for file Dmitry Antipov
2007-10-26 20:24 ` Andrew Morton

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