public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Antipov <antipov@dev.rtsoft.ru>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] 2.6.20-rc4: force fcntl(..., FASYNC) to return -EINVAL when f_op->fasync is NULL
Date: Fri, 12 Jan 2007 12:46:46 +0300	[thread overview]
Message-ID: <45A75906.5050609@dev.rtsoft.ru> (raw)

Hello,

this is a proposal fix needed to receive an error when the user requests
'fcntl(fd, F_SETFL, FASYNC)' but lower levels are too poor to handle this.

Dmitry

--- .orig-2.6.20-rc4/fs/fcntl.c	2007-01-12 08:27:10.000000000 +0300
+++ 2.6.20-rc4/fs/fcntl.c	2007-01-12 09:56:14.000000000 +0300
@@ -236,11 +236,11 @@

  	lock_kernel();
  	if ((arg ^ filp->f_flags) & FASYNC) {
-		if (filp->f_op && filp->f_op->fasync) {
+		error = -EINVAL;
+		if (filp->f_op && filp->f_op->fasync)
  			error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0);
-			if (error < 0)
-				goto out;
-		}
+		if (error < 0)
+			goto out;
  	}

  	filp->f_flags = (arg & SETFL_MASK) | (filp->f_flags & ~SETFL_MASK);

                 reply	other threads:[~2007-01-12  9:56 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=45A75906.5050609@dev.rtsoft.ru \
    --to=antipov@dev.rtsoft.ru \
    --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