]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.28/9p-fix-a-potential-acl-leak.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.28 / 9p-fix-a-potential-acl-leak.patch
1 From b5c66bab72a6a65edb15beb60b90d3cb84c5763b Mon Sep 17 00:00:00 2001
2 From: Cong Wang <xiyou.wangcong@gmail.com>
3 Date: Wed, 22 Feb 2017 15:40:53 -0800
4 Subject: 9p: fix a potential acl leak
5
6 From: Cong Wang <xiyou.wangcong@gmail.com>
7
8 commit b5c66bab72a6a65edb15beb60b90d3cb84c5763b upstream.
9
10 posix_acl_update_mode() could possibly clear 'acl', if so we leak the
11 memory pointed by 'acl'. Save this pointer before calling
12 posix_acl_update_mode() and release the memory if 'acl' really gets
13 cleared.
14
15 Link: http://lkml.kernel.org/r/1486678332-2430-1-git-send-email-xiyou.wangcong@gmail.com
16 Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
17 Reported-by: Mark Salyzyn <salyzyn@android.com>
18 Reviewed-by: Jan Kara <jack@suse.cz>
19 Reviewed-by: Greg Kurz <groug@kaod.org>
20 Cc: Eric Van Hensbergen <ericvh@gmail.com>
21 Cc: Ron Minnich <rminnich@sandia.gov>
22 Cc: Latchesar Ionkov <lucho@ionkov.net>
23 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
24 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27 ---
28 fs/9p/acl.c | 2 ++
29 1 file changed, 2 insertions(+)
30
31 --- a/fs/9p/acl.c
32 +++ b/fs/9p/acl.c
33 @@ -277,6 +277,7 @@ static int v9fs_xattr_set_acl(const stru
34 case ACL_TYPE_ACCESS:
35 if (acl) {
36 struct iattr iattr;
37 + struct posix_acl *old_acl = acl;
38
39 retval = posix_acl_update_mode(inode, &iattr.ia_mode, &acl);
40 if (retval)
41 @@ -287,6 +288,7 @@ static int v9fs_xattr_set_acl(const stru
42 * by the mode bits. So don't
43 * update ACL.
44 */
45 + posix_acl_release(old_acl);
46 value = NULL;
47 size = 0;
48 }