Skip to contentSkip to conversation

Do not send netlink socket release notification when socket is not bound

PATCH Applied Dmitry Ivanov 2 participants 2 messages Apr 6, 2016 – Apr 7, 2016 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Do not send netlink socket release notification when socket is not bound

This patch corrects the problem where non-privileged user may create netlink socket with port_id equal to port_id used by hostapd to create virtual wireless network interfaces. Call to bind() will fail for such socket, but release notification sent on close() or process termination to nl80211 subsystem will destroy virtual network interfaces while hostapd is still running.

---
 net/netlink/af_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netlink/af_netlink.c +1 -1
index 215fc08..330ebd6 100644
@@ -688,7 +688,7 @@ static int netlink_release(struct socket *sock)
 
 	skb_queue_purge(&sk->sk_write_queue);
 
-	if (nlk->portid) {
+	if (nlk->portid && nlk->bound) {
 		struct netlink_notify n = {
 						.net = sock_net(sk),
 						.protocol = sk->sk_protocol,
Signature · 1 line
2.1.4
#1 lore raw
Quoted 10 lines · Dmitry Ivanov

This patch corrects the problem where non-privileged user may create netlink socket with port_id equal to port_id used by hostapd to create
virtual wireless network interfaces. Call to bind() will fail for such
socket, but release notification sent on close() or process termination
to nl80211 subsystem will destroy virtual network interfaces while hostapd is still running.

Thanks Dmitry.

There are a number of issues with your patch still, such as describing the problem in too restricted ways (this problem is not specific to nl80211 nor fixed there). The subject should also have a proper prefix and you're not sending this patch to the right people.

If you prefer, I can take ownership of these patches.

johannes