From: Dan Carpenter Date: Thu, 18 Jun 2015 23:00:55 +0000 (+1000) Subject: fs/posix_acl.c: make posix_acl_create() safer and cleaner X-Git-Tag: omap-for-v4.2/fixes-rc1^2~6^2~23 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0c3a718e3ab2430a52a60d614b109e5e48e83e2;p=pandora-kernel.git fs/posix_acl.c: make posix_acl_create() safer and cleaner If posix_acl_create() returns an error code then "*acl" and "*default_acl" can be uninitialized or point to freed memory. This is a dangerous thing to do. For example, it causes a problem in ocfs2_reflink(): fs/ocfs2/refcounttree.c:4327 ocfs2_reflink() error: potentially using uninitialized 'default_acl'. I've re-written this so we set the pointers to NULL at the start. I've added a temporary "clone" variable to hold the value of "*acl" until end. Setting them to NULL means means we don't need the "no_acl" label. We may as well remove the "apply_umask" stuff forward and remove that label as well. Signed-off-by: Dan Carpenter Cc: Alexander Viro Cc: Joel Becker Cc: Mark Fasheh Signed-off-by: Andrew Morton --- Reading git-diff-tree failed