lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170828141045.14143.37805.stgit@john-Precision-Tower-5810>
Date:   Mon, 28 Aug 2017 07:10:45 -0700
From:   John Fastabend <john.fastabend@...il.com>
To:     ast@...nel.org, daniel@...earbox.net, davem@...emloft.net
Cc:     netdev@...r.kernel.org, john.fastabend@...il.com
Subject: [net-next PATCH 3/9] bpf: sockmap add missing rcu_read_(un)lock in
 smap_data_ready

References to psock must be done inside RCU critical section.

Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Signed-off-by: John Fastabend <john.fastabend@...il.com>
---
 kernel/bpf/sockmap.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c
index a6882e5..266011c8 100644
--- a/kernel/bpf/sockmap.c
+++ b/kernel/bpf/sockmap.c
@@ -227,11 +227,14 @@ static void smap_data_ready(struct sock *sk)
 {
 	struct smap_psock *psock;
 
-	write_lock_bh(&sk->sk_callback_lock);
+	rcu_read_lock();
 	psock = smap_psock_sk(sk);
-	if (likely(psock))
+	if (likely(psock)) {
+		write_lock_bh(&sk->sk_callback_lock);
 		strp_data_ready(&psock->strp);
-	write_unlock_bh(&sk->sk_callback_lock);
+		write_unlock_bh(&sk->sk_callback_lock);
+	}
+	rcu_read_unlock();
 }
 
 static void smap_tx_work(struct work_struct *w)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ