Smack: freeing an error pointer in smk_write_revoke_subj()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 11 Jun 2015 08:51:16 +0000 (11:51 +0300)
committerCasey Schaufler <casey@schaufler-ca.com>
Fri, 12 Jun 2015 18:59:11 +0000 (11:59 -0700)
commit5430209497eeb01415c681aaac0d00f65d24a526
tree88bb712ff5231e78e43f9d7a4c63f2bf2d1f8be2
parentc0d77c884461fc0dec0411e49797dc3f3651c31b
Smack: freeing an error pointer in smk_write_revoke_subj()

This code used to rely on the fact that kfree(NULL) was a no-op, but
then we changed smk_parse_smack() to return error pointers on failure
instead of NULL.  Calling kfree() on an error pointer will oops.

I have re-arranged things a bit so that we only free things if they
have been allocated.

Fixes: e774ad683f42 ('smack: pass error code through pointers')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
security/smack/smackfs.c