diff options
Diffstat (limited to 'net/core/scm.c')
-rw-r--r-- | net/core/scm.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/core/scm.c b/net/core/scm.c index b12303dd39d9..b7ba91b074b3 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -44,11 +44,13 @@ | |||
44 | 44 | ||
45 | static __inline__ int scm_check_creds(struct ucred *creds) | 45 | static __inline__ int scm_check_creds(struct ucred *creds) |
46 | { | 46 | { |
47 | const struct cred *cred = current_cred(); | ||
48 | |||
47 | if ((creds->pid == task_tgid_vnr(current) || capable(CAP_SYS_ADMIN)) && | 49 | if ((creds->pid == task_tgid_vnr(current) || capable(CAP_SYS_ADMIN)) && |
48 | ((creds->uid == current->uid || creds->uid == current->euid || | 50 | ((creds->uid == cred->uid || creds->uid == cred->euid || |
49 | creds->uid == current->suid) || capable(CAP_SETUID)) && | 51 | creds->uid == cred->suid) || capable(CAP_SETUID)) && |
50 | ((creds->gid == current->gid || creds->gid == current->egid || | 52 | ((creds->gid == cred->gid || creds->gid == cred->egid || |
51 | creds->gid == current->sgid) || capable(CAP_SETGID))) { | 53 | creds->gid == cred->sgid) || capable(CAP_SETGID))) { |
52 | return 0; | 54 | return 0; |
53 | } | 55 | } |
54 | return -EPERM; | 56 | return -EPERM; |