netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* assertion (!atomic_read(&sk->sk_rmem_alloc)) failed at net/netlink/af_netlink.c (122)
@ 2005-05-10 12:43 Ken-ichirou MATSUZAWA
  2005-05-10 22:07 ` Herbert Xu
  0 siblings, 1 reply; 14+ messages in thread
From: Ken-ichirou MATSUZAWA @ 2005-05-10 12:43 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: Text/Plain, Size: 438 bytes --]

 Hello.

Everytime on shutting down, the subject message is logged.  
It seems that the reason is do_one_broadcast may preempt
netlink_recvmsg. Added patch to 2.6.12-rc4 seems resolving this
problem.

But I'm not a kernel hacker. I don't understand design, detail and
the intenstion of struct netlink_broadcast_data, so that I hope
someone to do more tidy work. In addition, please check 2.4 kernel
and pfkey_broadcast_one too.

Thanks.


[-- Attachment #2: af_netlink.diff --]
[-- Type: Text/Plain, Size: 1503 bytes --]

--- net/netlink/af_netlink.c.orig	2005-05-10 21:03:11.000000000 +0900
+++ net/netlink/af_netlink.c	2005-05-10 21:10:39.000000000 +0900
@@ -721,7 +721,7 @@
 	int congested;
 	int delivered;
 	int allocation;
-	struct sk_buff *skb, *skb2;
+	struct sk_buff *skb;
 };
 
 static inline int do_one_broadcast(struct sock *sk,
@@ -729,6 +729,7 @@
 {
 	struct netlink_sock *nlk = nlk_sk(sk);
 	int val;
+	struct sk_buff *skb;
 
 	if (p->exclude_sk == sk)
 		goto out;
@@ -741,25 +742,21 @@
 		goto out;
 	}
 
-	sock_hold(sk);
-	if (p->skb2 == NULL) {
-		if (atomic_read(&p->skb->users) != 1) {
-			p->skb2 = skb_clone(p->skb, p->allocation);
-		} else {
-			p->skb2 = p->skb;
-			atomic_inc(&p->skb->users);
-		}
-	}
-	if (p->skb2 == NULL) {
+	skb = skb_clone(p->skb, p->allocation);
+	if (skb == NULL) {
 		netlink_overrun(sk);
 		/* Clone failed. Notify ALL listeners. */
 		p->failure = 1;
-	} else if ((val = netlink_broadcast_deliver(sk, p->skb2)) < 0) {
+		goto out;
+	}
+
+	sock_hold(sk);
+	if ((val = netlink_broadcast_deliver(sk, skb)) < 0) {
 		netlink_overrun(sk);
+		kfree_skb(skb);
 	} else {
 		p->congested |= val;
 		p->delivered = 1;
-		p->skb2 = NULL;
 	}
 	sock_put(sk);
 
@@ -784,7 +781,6 @@
 	info.delivered = 0;
 	info.allocation = allocation;
 	info.skb = skb;
-	info.skb2 = NULL;
 
 	/* While we sleep in clone, do not allow to change socket list */
 
@@ -795,8 +791,6 @@
 
 	netlink_unlock_table();
 
-	if (info.skb2)
-		kfree_skb(info.skb2);
 	kfree_skb(skb);
 
 	if (info.delivered) {

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

end of thread, other threads:[~2005-05-19 21:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-10 12:43 assertion (!atomic_read(&sk->sk_rmem_alloc)) failed at net/netlink/af_netlink.c (122) Ken-ichirou MATSUZAWA
2005-05-10 22:07 ` Herbert Xu
2005-05-11  0:58   ` Herbert Xu
2005-05-11 15:20     ` Ken-ichirou MATSUZAWA
2005-05-11 22:17     ` Tommy Christensen
2005-05-11 22:22       ` Herbert Xu
2005-05-19 19:47         ` David S. Miller
2005-05-11 23:17       ` Herbert Xu
2005-05-12  9:58         ` Tommy Christensen
2005-05-12 10:42           ` Herbert Xu
2005-05-12 10:58             ` Tommy Christensen
2005-05-12 11:07               ` Herbert Xu
2005-05-19 19:49                 ` David S. Miller
2005-05-19 21:34                   ` Herbert Xu

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).