Merge tag 'locks-v4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Nov 2017 21:21:58 +0000 (13:21 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Nov 2017 21:21:58 +0000 (13:21 -0800)
Pull file locking update from Jeff Layton:
 "A couple of fixes for a patch that went into v4.14, and the bug report
  just came in a few days ago.. It passes my (minimal) testing, and has
  been in linux-next for a few days now.

  I also would like to get my address changed in MAINTAINERS to clear
  that hurdle"

* tag 'locks-v4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux:
  fcntl: don't cap l_start and l_end values for F_GETLK64 in compat syscall
  fcntl: don't leak fd reference when fixup_compat_flock fails
  MAINTAINERS: s/jlayton@poochiereds.net/jlayton@kernel.org/

MAINTAINERS
arch/arm64/include/asm/compat.h
arch/mips/include/asm/compat.h
arch/parisc/include/asm/compat.h
arch/powerpc/include/asm/compat.h
arch/s390/include/asm/compat.h
arch/sparc/include/asm/compat.h
arch/tile/include/asm/compat.h
arch/x86/include/asm/compat.h
fs/fcntl.c

index ec3ec17c6c115515177f5a1e5f4fb4f403cb2314..2098512e9f101e7a188252d0c2da15848ed77d76 100644 (file)
@@ -5216,7 +5216,7 @@ F:        drivers/video/fbdev/s1d13xxxfb.c
 F:     include/video/s1d13xxxfb.h
 
 ERRSEQ ERROR TRACKING INFRASTRUCTURE
-M:     Jeff Layton <jlayton@poochiereds.net>
+M:     Jeff Layton <jlayton@kernel.org>
 S:     Maintained
 F:     lib/errseq.c
 F:     include/linux/errseq.h
@@ -5404,7 +5404,7 @@ F:        include/scsi/libfcoe.h
 F:     include/uapi/scsi/fc/
 
 FILE LOCKING (flock() and fcntl()/lockf())
-M:     Jeff Layton <jlayton@poochiereds.net>
+M:     Jeff Layton <jlayton@kernel.org>
 M:     "J. Bruce Fields" <bfields@fieldses.org>
 L:     linux-fsdevel@vger.kernel.org
 S:     Maintained
@@ -7550,7 +7550,7 @@ S:        Odd Fixes
 
 KERNEL NFSD, SUNRPC, AND LOCKD SERVERS
 M:     "J. Bruce Fields" <bfields@fieldses.org>
-M:     Jeff Layton <jlayton@poochiereds.net>
+M:     Jeff Layton <jlayton@kernel.org>
 L:     linux-nfs@vger.kernel.org
 W:     http://nfs.sourceforge.net/
 T:     git git://linux-nfs.org/~bfields/linux.git
index e39d487bf7243850164cd22171837c9f9340cf3e..a3c7f271ad4c79dc982597b4ff99edcf01400abd 100644 (file)
@@ -215,7 +215,6 @@ typedef struct compat_siginfo {
 } compat_siginfo_t;
 
 #define COMPAT_OFF_T_MAX       0x7fffffff
-#define COMPAT_LOFF_T_MAX      0x7fffffffffffffffL
 
 /*
  * A pointer passed in from user mode. This should not
index 8e2b5b55648868199deed2f8e9aae5bafdf60d98..49691331ada4c1b8d8632fc8293a246e657cdb63 100644 (file)
@@ -200,7 +200,6 @@ typedef struct compat_siginfo {
 } compat_siginfo_t;
 
 #define COMPAT_OFF_T_MAX       0x7fffffff
-#define COMPAT_LOFF_T_MAX      0x7fffffffffffffffL
 
 /*
  * A pointer passed in from user mode. This should not
index 07f48827afdae8500fc7bc54294a5befee9b7e86..acf8aa07cbe099e35972e7d381d743da37bb2a5e 100644 (file)
@@ -195,7 +195,6 @@ typedef struct compat_siginfo {
 } compat_siginfo_t;
 
 #define COMPAT_OFF_T_MAX       0x7fffffff
-#define COMPAT_LOFF_T_MAX      0x7fffffffffffffffL
 
 struct compat_ipc64_perm {
        compat_key_t key;
index a035b1e5dfa7c6b5ae8ba10a1e1ad58d962c4a4b..8a2aecfe9b0246cbbea75a66aaa3020322fc87c5 100644 (file)
@@ -185,7 +185,6 @@ typedef struct compat_siginfo {
 } compat_siginfo_t;
 
 #define COMPAT_OFF_T_MAX       0x7fffffff
-#define COMPAT_LOFF_T_MAX      0x7fffffffffffffffL
 
 /*
  * A pointer passed in from user mode. This should not
index 1b60eb3676d55640c515633e799bbb7fde610b7d..5e6a63641a5f1916da30507eb744534a2da95486 100644 (file)
@@ -263,7 +263,6 @@ typedef struct compat_siginfo {
 #define si_overrun     _sifields._timer._overrun
 
 #define COMPAT_OFF_T_MAX       0x7fffffff
-#define COMPAT_LOFF_T_MAX      0x7fffffffffffffffL
 
 /*
  * A pointer passed in from user mode. This should not
index 977c3f280ba1900bf6d1a21990a0b17decc9821e..fa38c78de0f001f15c63d65632a78f3ce37c3def 100644 (file)
@@ -209,7 +209,6 @@ typedef struct compat_siginfo {
 } compat_siginfo_t;
 
 #define COMPAT_OFF_T_MAX       0x7fffffff
-#define COMPAT_LOFF_T_MAX      0x7fffffffffffffffL
 
 /*
  * A pointer passed in from user mode. This should not
index c14e36f008c8f3a047fa4a9a583735a01264bcb3..62a7b83025dd24ab264d2d2901931b35c5ae9c2d 100644 (file)
@@ -173,7 +173,6 @@ typedef struct compat_siginfo {
 } compat_siginfo_t;
 
 #define COMPAT_OFF_T_MAX       0x7fffffff
-#define COMPAT_LOFF_T_MAX      0x7fffffffffffffffL
 
 struct compat_ipc64_perm {
        compat_key_t key;
index a600a6cda9ecdf170c1a70ed151e5b0a5c01a1ba..2cbd75dd2fd3542b9cb993fb6fd4f436e605c062 100644 (file)
@@ -210,7 +210,6 @@ typedef struct compat_siginfo {
 } compat_siginfo_t;
 
 #define COMPAT_OFF_T_MAX       0x7fffffff
-#define COMPAT_LOFF_T_MAX      0x7fffffffffffffffL
 
 struct compat_ipc64_perm {
        compat_key_t key;
index 30f47d0f74a00985149ee8123f34531643232711..0522e283a4f48c1b5bfc2433de9ad12d82cfc891 100644 (file)
@@ -563,6 +563,9 @@ static int put_compat_flock64(const struct flock *kfl, struct compat_flock64 __u
 {
        struct compat_flock64 fl;
 
+       BUILD_BUG_ON(sizeof(kfl->l_start) > sizeof(ufl->l_start));
+       BUILD_BUG_ON(sizeof(kfl->l_len) > sizeof(ufl->l_len));
+
        memset(&fl, 0, sizeof(struct compat_flock64));
        copy_flock_fields(&fl, kfl);
        if (copy_to_user(ufl, &fl, sizeof(struct compat_flock64)))
@@ -632,9 +635,8 @@ COMPAT_SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
                if (err)
                        break;
                err = fixup_compat_flock(&flock);
-               if (err)
-                       return err;
-               err = put_compat_flock(&flock, compat_ptr(arg));
+               if (!err)
+                       err = put_compat_flock(&flock, compat_ptr(arg));
                break;
        case F_GETLK64:
        case F_OFD_GETLK:
@@ -642,12 +644,8 @@ COMPAT_SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
                if (err)
                        break;
                err = fcntl_getlk(f.file, convert_fcntl_cmd(cmd), &flock);
-               if (err)
-                       break;
-               err = fixup_compat_flock(&flock);
-               if (err)
-                       return err;
-               err = put_compat_flock64(&flock, compat_ptr(arg));
+               if (!err)
+                       err = put_compat_flock64(&flock, compat_ptr(arg));
                break;
        case F_SETLK:
        case F_SETLKW: