AFS: Potential null dereference
authorDan Carpenter <error27@gmail.com>
Mon, 22 Mar 2010 13:07:14 +0000 (13:07 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 22 Mar 2010 16:57:19 +0000 (09:57 -0700)
It seems clear from the surrounding code that xpermits is allowed to be
NULL here.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/afs/security.c

index 3ef504370034c2311fdd50f631856ac95ab76903..bb4ed144d0e446c627fb8b4e391664058d094b87 100644 (file)
@@ -189,8 +189,9 @@ void afs_cache_permit(struct afs_vnode *vnode, struct key *key, long acl_order)
        if (!permits)
                goto out_unlock;
 
-       memcpy(permits->permits, xpermits->permits,
-              count * sizeof(struct afs_permit));
+       if (xpermits)
+               memcpy(permits->permits, xpermits->permits,
+                       count * sizeof(struct afs_permit));
 
        _debug("key %x access %x",
               key_serial(key), vnode->status.caller_access);