linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Do not send netlink socket release notification when socket is not bound
@ 2016-04-06 14:22 Dmitry Ivanov
  2016-04-07  7:13 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Ivanov @ 2016-04-06 14:22 UTC (permalink / raw)
  To: linux-wireless

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.

Signed-off-by: Dmitry Ivanov <dima@ubnt.com>
---
 net/netlink/af_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 215fc08..330ebd6 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -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,
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] Do not send netlink socket release notification when socket is not bound
  2016-04-06 14:22 [PATCH 1/2] Do not send netlink socket release notification when socket is not bound Dmitry Ivanov
@ 2016-04-07  7:13 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2016-04-07  7:13 UTC (permalink / raw)
  To: Dmitry Ivanov, linux-wireless

On Wed, 2016-04-06 at 17:22 +0300, Dmitry Ivanov wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-07  7:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-06 14:22 [PATCH 1/2] Do not send netlink socket release notification when socket is not bound Dmitry Ivanov
2016-04-07  7:13 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).