Skip to contentSkip to conversation

net: Make sure BHs are disabled in sock_prot_inuse_add()

PATCH Applied Eric Dumazet 2 participants 4 messages Nov 24, 2008 – Nov 25, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Make sure BHs are disabled in sock_prot_inuse_add()

Third round of patch about sock_prot_inuse_add() ...

Thanks

[PATCH] net: Make sure BHs are disabled in sock_prot_inuse_add()

There is still a call to sock_prot_inuse_add() in af_netlink while in a preemptable section. Add explicit BH disable around this call.

net/netlink/af_netlink.c +2 -0
index c7d7657..9eb895c 100644
@@ -515,7 +515,9 @@ static int netlink_release(struct socket *sock)
 	kfree(nlk->groups);
 	nlk->groups = NULL;
 
+	local_bh_disable();
 	sock_prot_inuse_add(sock_net(sk), &netlink_proto, -1);
+	local_bh_enable();
 	sock_put(sk);
 	return 0;
 }
maintainer Applied
#1 lore raw

From: Eric Dumazet <[email protected]>
Date: Mon, 24 Nov 2008 18:23:24 +0100

Quoted 11 lines

Third round of patch about sock_prot_inuse_add() ...

Thanks

[PATCH] net: Make sure BHs are disabled in sock_prot_inuse_add()

There is still a call to sock_prot_inuse_add() in af_netlink while in a preemptable section. Add explicit BH disable around this call.

Applied, thanks Eric.

#2 lore raw

PATCH 1/1 net: Make sure BHs are disabled in sock_prot_inuse_add()

In reply to Eric Dumazet

Oh well...

[PATCH] net: Make sure BHs are disabled in sock_prot_inuse_add()

prot->destroy is not called with BH disabled. So we must add explicit BH disable around call to sock_prot_inuse_add() in sctp_destroy_sock()

net/sctp/socket.c +2 -0
index f03af84..ba81fe3 100644
@@ -3633,7 +3633,9 @@ SCTP_STATIC void sctp_destroy_sock(struct sock *sk)
 	ep = sctp_sk(sk)->ep;
 	sctp_endpoint_free(ep);
 	atomic_dec(&sctp_sockets_allocated);
+	local_bh_disable();
 	sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
+	local_bh_enable();
 }
 
 /* API 4.1.7 shutdown() - TCP Style Syntax
maintainer Applied
#3 lore raw

From: Eric Dumazet <[email protected]>
Date: Tue, 25 Nov 2008 21:35:23 +0100

Quoted 9 lines

Oh well...

[PATCH] net: Make sure BHs are disabled in sock_prot_inuse_add()

prot->destroy is not called with BH disabled. So we must add explicit BH disable around call to sock_prot_inuse_add() in sctp_destroy_sock()

At least it was found eventually :)

Applied, thanks Eric.