summaryrefslogtreecommitdiff
path: root/drivers/staging/lustre/lustre/ptlrpc/sec.c
diff options
context:
space:
mode:
authorLidza Louina <lidza.louina@oracle.com>2016-05-16 14:51:42 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-07 22:38:19 -0700
commitdb3c16cdde24ecd59df0f24f93f1a4ba177f4b82 (patch)
treec840fd0a47f422945b1f057903b91aac7e048e4a /drivers/staging/lustre/lustre/ptlrpc/sec.c
parent423b09b8f45c8771bca84d41c3254c3904d78a0a (diff)
staging/lustre/ptlrpc: Removes potential null dereference
The lustre_msg_buf method could return NULL. Subsequent code didn't check if it's null before using it. This patch adds two checks. Signed-off-by: Lidza Louina <lidza.louina@oracle.com> Acked-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/ptlrpc/sec.c')
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/sec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c
index 187fd1d6898c..657b41fdf4c5 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
@@ -2196,6 +2196,9 @@ int sptlrpc_pack_user_desc(struct lustre_msg *msg, int offset)
pud = lustre_msg_buf(msg, offset, 0);
+ if (!pud)
+ return -EINVAL;
+
pud->pud_uid = from_kuid(&init_user_ns, current_uid());
pud->pud_gid = from_kgid(&init_user_ns, current_gid());
pud->pud_fsuid = from_kuid(&init_user_ns, current_fsuid());