Commit 0e326df0 authored by Paul Moore's avatar Paul Moore
Browse files

selinux: various sparse fixes



When running the SELinux code through sparse, there are a handful of
warnings.  This patch resolves some of these warnings caused by
"__rcu" mismatches.

 % make W=1 C=1 security/selinux/

Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 6bc1968c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2553,7 +2553,7 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
	if (rc) {
		clear_itimer();

		spin_lock_irq(&current->sighand->siglock);
		spin_lock_irq(&unrcu_pointer(current->sighand)->siglock);
		if (!fatal_signal_pending(current)) {
			flush_sigqueue(&current->pending);
			flush_sigqueue(&current->signal->shared_pending);
@@ -2561,13 +2561,13 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
			sigemptyset(&current->blocked);
			recalc_sigpending();
		}
		spin_unlock_irq(&current->sighand->siglock);
		spin_unlock_irq(&unrcu_pointer(current->sighand)->siglock);
	}

	/* Wake up the parent if it is waiting so that it can recheck
	 * wait permission to the new task SID. */
	read_lock(&tasklist_lock);
	__wake_up_parent(current, current->real_parent);
	__wake_up_parent(current, unrcu_pointer(current->real_parent));
	read_unlock(&tasklist_lock);
}

+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ static void sel_ib_pkey_insert(struct sel_ib_pkey *pkey)

		tail = list_entry(
			rcu_dereference_protected(
				sel_ib_pkey_hash[idx].list.prev,
				list_tail_rcu(&sel_ib_pkey_hash[idx].list),
				lockdep_is_held(&sel_ib_pkey_lock)),
			struct sel_ib_pkey, list);
		list_del_rcu(&tail->list);
+3 −2
Original line number Diff line number Diff line
@@ -164,7 +164,8 @@ static void sel_netnode_insert(struct sel_netnode *node)
	if (sel_netnode_hash[idx].size == SEL_NETNODE_HASH_BKT_LIMIT) {
		struct sel_netnode *tail;
		tail = list_entry(
			rcu_dereference_protected(sel_netnode_hash[idx].list.prev,
			rcu_dereference_protected(
				list_tail_rcu(&sel_netnode_hash[idx].list),
				lockdep_is_held(&sel_netnode_lock)),
			struct sel_netnode, list);
		list_del_rcu(&tail->list);
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ static void sel_netport_insert(struct sel_netport *port)
		struct sel_netport *tail;
		tail = list_entry(
			rcu_dereference_protected(
				sel_netport_hash[idx].list.prev,
				list_tail_rcu(&sel_netport_hash[idx].list),
				lockdep_is_held(&sel_netport_lock)),
			struct sel_netport, list);
		list_del_rcu(&tail->list);