Linux: Use current_creds() if stashed creds fail

If we can't use our stashed credentials (because SELinux hates us,
most likely), then fall back to trying the processes current credentials
instead of just oopsing.

Change-Id: Ib3676ff66f8400e86cccb97fb207a5f094ceb4ad
Reviewed-on: http://gerrit.openafs.org/1283
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Simon Wilkinson 2010-02-09 19:53:40 +00:00 committed by Derrick Brashear
parent 762c8b41ed
commit bcdb5220e2

View File

@ -56,6 +56,8 @@ afs_linux_raw_open(afs_dcache_id_t *ainode)
#if defined(STRUCT_TASK_HAS_CRED)
/* Use stashed credentials - prevent selinux/apparmor problems */
filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, cache_creds);
if (IS_ERR(filp))
filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, current_cred());
#else
filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR);
#endif