diff options
author | Jeff Layton <jlayton@redhat.com> | 2017-11-14 14:43:56 -0500 |
---|---|---|
committer | Jeff Layton <jlayton@redhat.com> | 2017-11-15 08:08:36 -0500 |
commit | 9280a601e6080c9ff658468c1c775ff6514099a6 (patch) | |
tree | 0a5dc48bc01349b5c46a24427cd75616e0bc2e51 /fs/fcntl.c | |
parent | 4e897f5bb9af5a1d4da07ae0c6598c6ee4e08471 (diff) |
fcntl: don't leak fd reference when fixup_compat_flock fails
Currently we just return err here, but we need to put the fd reference
first.
Fixes: 94073ad77fff (fs/locks: don't mess with the address limit in compat_fcntl64)
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'fs/fcntl.c')
-rw-r--r-- | fs/fcntl.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/fcntl.c b/fs/fcntl.c index 30f47d0f74a0..e15bcc4265d0 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -632,9 +632,8 @@ COMPAT_SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd, | |||
632 | if (err) | 632 | if (err) |
633 | break; | 633 | break; |
634 | err = fixup_compat_flock(&flock); | 634 | err = fixup_compat_flock(&flock); |
635 | if (err) | 635 | if (!err) |
636 | return err; | 636 | err = put_compat_flock(&flock, compat_ptr(arg)); |
637 | err = put_compat_flock(&flock, compat_ptr(arg)); | ||
638 | break; | 637 | break; |
639 | case F_GETLK64: | 638 | case F_GETLK64: |
640 | case F_OFD_GETLK: | 639 | case F_OFD_GETLK: |