smack: pass error code through pointers
authorLukasz Pawelczyk <l.pawelczyk@samsung.com>
Mon, 20 Apr 2015 15:12:54 +0000 (17:12 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 14 Dec 2016 04:48:22 +0000 (13:48 +0900)
commit00b1f2ec4dc25148f779463a3fcf8d62a1eea950
treea7f841c680d87edea86693ef63ff89a4a150940e
parente439b9551813f8e869c3ae30e26a803d5f608b40
smack: pass error code through pointers

This patch makes the following functions to use ERR_PTR() and related
macros to pass the appropriate error code through returned pointers:

smk_parse_smack()
smk_import_entry()
smk_fetch()

It also makes all the other functions that use them to handle the
error cases properly. This ways correct error codes from places
where they happened can be propagated to the user space if necessary.

Doing this it fixes a bug in onlycap and unconfined files
handling. Previously their content was cleared on any error from
smk_import_entry/smk_parse_smack, be it EINVAL (as originally intended)
or ENOMEM. Right now it only reacts on EINVAL passing other codes
properly to userspace.

Comments have been updated accordingly.

Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
security/smack/smack_access.c
security/smack/smack_lsm.c
security/smack/smackfs.c