Smack: fix backport of multi-onlycap patch
authorRafal Krypa <r.krypa@samsung.com>
Tue, 23 Jun 2015 08:30:49 +0000 (10:30 +0200)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 24 Jun 2015 02:58:02 +0000 (11:58 +0900)
Adapt the patch for multiple labels in onlycap to older kernel version.
It was previously backported without an important dependency. There is a
difference in smk_import_entry function. In upstream it returns error codes,
but here the error is indicated by returning NULL.
Without this fix the kernel could crash when empty string is written to
onlycap interface file.

Change-Id: Ibadab8b78b86453526cd423100619ab0a10fa68c
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
security/smack/smackfs.c

index 9a4b767..3e6c2e5 100644 (file)
@@ -1731,8 +1731,8 @@ static ssize_t smk_write_onlycap(struct file *file, const char __user *buf,
                        continue;
 
                skp = smk_import_entry(tok, 0);
-               if (IS_ERR(skp)) {
-                       rc = PTR_ERR(skp);
+               if (skp == NULL) {
+                       rc = -EINVAL;
                        break;
                }