Smack: Traverse the smack_known_list using list_for_each_entry_rcu macro
authorVishal Goel <vishal.goel@samsung.com>
Wed, 23 Nov 2016 05:15:31 +0000 (10:45 +0530)
committerCasey Schaufler <casey@schaufler-ca.com>
Tue, 10 Jan 2017 17:47:20 +0000 (09:47 -0800)
In smack_from_secattr function,"smack_known_list" is being traversed
using list_for_each_entry macro, although it is a rcu protected
structure. So it should be traversed using "list_for_each_entry_rcu"
macro to fetch the rcu protected entry.

Signed-off-by: Vishal Goel <vishal.goel@samsung.com>
Signed-off-by: Himanshu Shukla <himanshu.sh@samsung.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
security/smack/smack_lsm.c

index 5deda8e0fe965229bc73168b7145733e0b96e539..4dd458a2b1e856ddf3c2e2886ba8497d5a692f4c 100644 (file)
@@ -3900,7 +3900,7 @@ static struct smack_known *smack_from_secattr(struct netlbl_lsm_secattr *sap,
                 * ambient value.
                 */
                rcu_read_lock();
-               list_for_each_entry(skp, &smack_known_list, list) {
+               list_for_each_entry_rcu(skp, &smack_known_list, list) {
                        if (sap->attr.mls.lvl != skp->smk_netlabel.attr.mls.lvl)
                                continue;
                        /*