public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: matthew@wil.cx, linux-kernel@vger.kernel.org
Subject: [PATCH - 2.6.15-rc1-mm1 ] Re-fix compat_sys_fcntl64
Date: Fri, 18 Nov 2005 20:56:45 +1100	[thread overview]
Message-ID: <1051118095645.17025@suse.de> (raw)
In-Reply-To: 20051118204902.15825.patches@notabene


Finally got some testing done on this, and it wasn't quite right.  We
need to return information from F_GETLK no-matter what l_type is - at
the very least we return a value in l_type, but might return start/length as well. 

This patch has been tested (LSB test suite), and works.

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./fs/compat.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff ./fs/compat.c~current~ ./fs/compat.c
--- ./fs/compat.c~current~	2005-11-18 11:49:08.000000000 +1100
+++ ./fs/compat.c	2005-11-18 11:49:57.000000000 +1100
@@ -493,9 +493,9 @@ asmlinkage long compat_sys_fcntl64(unsig
 		set_fs(KERNEL_DS);
 		ret = sys_fcntl(fd, cmd, (unsigned long)&f);
 		set_fs(old_fs);
-		if (cmd == F_GETLK && ret == 0 && f.l_type == F_UNLCK) {
-			/* there was a conflicting lock, and we need to return
-			 * the data... but it needs to fit in the compat structure.
+		if (cmd == F_GETLK && ret == 0) {
+			/* GETLK was successfule and we need to return the data...
+			 * but it needs to fit in the compat structure.
 			 * l_start shouldn't be too big, unless the original
 			 * start + end is greater than COMPAT_OFF_T_MAX, in which
 			 * case the app was asking for trouble, so we return
@@ -526,7 +526,7 @@ asmlinkage long compat_sys_fcntl64(unsig
 				((cmd == F_SETLK64) ? F_SETLK : F_SETLKW),
 				(unsigned long)&f);
 		set_fs(old_fs);
-		if (cmd == F_GETLK64 && ret == 0 && f.l_type == F_UNLCK) {
+		if (cmd == F_GETLK64 && ret == 0) {
 			/* need to return lock information - see above for commentary */
 			if (f.l_start > COMPAT_LOFF_T_MAX)
 				ret = -EOVERFLOW;

           reply	other threads:[~2005-11-18  9:57 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20051118204902.15825.patches@notabene>]

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=1051118095645.17025@suse.de \
    --to=neilb@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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