Smack: update patch for multi-onlycap to the final upstream version
authorRafal Krypa <r.krypa@samsung.com>
Tue, 23 Jun 2015 08:28:09 +0000 (10:28 +0200)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 24 Jun 2015 02:57:18 +0000 (11:57 +0900)
Synchronize the patch enabling multiple labels in onlycap with the last
version that was merged upstream. The patch merged in this tree was an
earlier version, before it was updated and merged upstream.
Changes are only cosmetic (function name, comments, code formatting), but
merging them will ease future synchronization with upstream Smack code.

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

index 3153b5b..9a4b767 100644 (file)
@@ -1655,7 +1655,7 @@ static int smk_open_onlycap(struct inode *inode, struct file *file)
 }
 
 /**
- * list_swap_rcu - swap public list with a private one in RCU-safe way
+ * smk_list_swap_rcu - swap public list with a private one in RCU-safe way
  * The caller must hold appropriate mutex to prevent concurrent modifications
  * to the public list.
  * Private list is assumed to be not accessible to other threads yet.
@@ -1663,7 +1663,8 @@ static int smk_open_onlycap(struct inode *inode, struct file *file)
  * @public: public list
  * @private: private list
  */
-static void list_swap_rcu(struct list_head *public, struct list_head *private)
+static void smk_list_swap_rcu(struct list_head *public,
+                             struct list_head *private)
 {
        struct list_head *first, *last;
 
@@ -1747,13 +1748,10 @@ static ssize_t smk_write_onlycap(struct file *file, const char __user *buf,
        kfree(data);
 
        /*
-        * Should the null string be passed in unset the onlycap value.
-        * This seems like something to be careful with as usually
-        * smk_import only expects to return NULL for errors. It
-        * is usually the case that a nullstring or "\n" would be
-        * bad to pass to smk_import but in fact this is useful here.
+        * Clear the smack_onlycap on invalid label errors. This means
+        * that we can pass a null string to unset the onlycap value.
         *
-        * smk_import will also reject a label beginning with '-',
+        * Importing will also reject a label beginning with '-',
         * so "-usecapabilities" will also work.
         *
         * But do so only on invalid label, not on system errors.
@@ -1764,7 +1762,7 @@ static ssize_t smk_write_onlycap(struct file *file, const char __user *buf,
 
        if (rc >= 0) {
                mutex_lock(&smack_onlycap_lock);
-               list_swap_rcu(&smack_onlycap_list, &list_tmp);
+               smk_list_swap_rcu(&smack_onlycap_list, &list_tmp);
                mutex_unlock(&smack_onlycap_lock);
        }