netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [NETLINK] netlink_ack takes gfp flag as parameter
@ 2004-09-24  1:12 Pablo Neira
  2004-09-24  2:12 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira @ 2004-09-24  1:12 UTC (permalink / raw)
  To: netdev, David S. Miller

[-- Attachment #1: Type: text/plain, Size: 275 bytes --]

Hi Davem,

AFAIK ip_queue, ip6_queue and dn_rtmsg use netlink_ack in interrupt 
context which calls alloc_skb with the GFP_KERNEL flag. This patch adds 
a new parameter to netlink_ack to set the gfp flag.

Signed-off-by: Pablo Neira Ayuso <pablo@eurodev.net>

regards,
Pablo

[-- Attachment #2: netlink_ack.patch --]
[-- Type: text/x-patch, Size: 1385 bytes --]

===== include/linux/netlink.h 1.19 vs edited =====
--- 1.19/include/linux/netlink.h	Sat Aug 28 02:13:43 2004
+++ edited/include/linux/netlink.h	Fri Sep 24 02:02:05 2004
@@ -119,7 +119,7 @@
 extern void netlink_detach(int unit);
 extern int netlink_post(int unit, struct sk_buff *skb);
 extern struct sock *netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len));
-extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
+extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err, int gfp_mask);
 extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
 extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
 			     __u32 group, int allocation);
===== net/netlink/af_netlink.c 1.56 vs edited =====
--- 1.56/net/netlink/af_netlink.c	Fri Sep 24 02:01:00 2004
+++ edited/net/netlink/af_netlink.c	Fri Sep 24 02:02:06 2004
@@ -957,7 +957,8 @@
 	return 0;
 }
 
-void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
+void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err, 
+		 int gfp_mask)
 {
 	struct sk_buff *skb;
 	struct nlmsghdr *rep;
@@ -969,7 +970,7 @@
 	else
 		size = NLMSG_SPACE(4 + NLMSG_ALIGN(nlh->nlmsg_len));
 
-	skb = alloc_skb(size, GFP_KERNEL);
+	skb = alloc_skb(size, gfp_mask);
 	if (!skb) {
 		struct sock *sk;
 

[-- Attachment #3: netlink_ack-audit.patch --]
[-- Type: text/x-patch, Size: 485 bytes --]

===== kernel/audit.c 1.3 vs edited =====
--- 1.3/kernel/audit.c	Tue Sep 14 02:23:21 2004
+++ edited/kernel/audit.c	Fri Sep 24 02:02:06 2004
@@ -419,9 +419,9 @@
 		if (rlen > skb->len)
 			rlen = skb->len;
 		if ((err = audit_receive_msg(skb, nlh))) {
-			netlink_ack(skb, nlh, -err);
+			netlink_ack(skb, nlh, -err, GFP_KERNEL);
 		} else if (nlh->nlmsg_flags & NLM_F_ACK)
-			netlink_ack(skb, nlh, 0);
+			netlink_ack(skb, nlh, 0, GFP_KERNEL);
 		skb_pull(skb, rlen);
 	}
 	return 0;

[-- Attachment #4: netlink_ack-dn_rtmsg.patch --]
[-- Type: text/x-patch, Size: 482 bytes --]

===== net/decnet/netfilter/dn_rtmsg.c 1.3 vs edited =====
--- 1.3/net/decnet/netfilter/dn_rtmsg.c	Thu Jun  5 02:57:08 2003
+++ edited/net/decnet/netfilter/dn_rtmsg.c	Fri Sep 24 02:14:31 2004
@@ -99,7 +99,9 @@
 }
 
 
-#define RCV_SKB_FAIL(err) do { netlink_ack(skb, nlh, (err)); return; } while (0)
+#define RCV_SKB_FAIL(err) do {					\
+	netlink_ack(skb, nlh, (err), GFP_ATOMIC); return; 	\
+	} while (0) 						\
 
 static inline void dnrmg_receive_user_skb(struct sk_buff *skb)
 {

[-- Attachment #5: netlink_ack-ip6_queue.patch --]
[-- Type: text/x-patch, Size: 506 bytes --]

===== net/ipv6/netfilter/ip6_queue.c 1.14 vs edited =====
--- 1.14/net/ipv6/netfilter/ip6_queue.c	Thu Jan 29 00:59:34 2004
+++ edited/net/ipv6/netfilter/ip6_queue.c	Fri Sep 24 02:19:58 2004
@@ -474,7 +474,9 @@
 		ipq_issue_verdict(entry, NF_DROP);
 }
 
-#define RCV_SKB_FAIL(err) do { netlink_ack(skb, nlh, (err)); return; } while (0)
+#define RCV_SKB_FAIL(err) do {					\
+	netlink_ack(skb, nlh, (err), GFP_ATOMIC); return; 	\
+	} while (0) 						\
 
 static inline void
 ipq_rcv_skb(struct sk_buff *skb)

[-- Attachment #6: netlink_ack-ip_queue.c --]
[-- Type: text/x-csrc, Size: 668 bytes --]

===== net/ipv4/netfilter/ip_queue.c 1.17 vs edited =====
--- 1.17/net/ipv4/netfilter/ip_queue.c	Tue Sep  7 23:18:28 2004
+++ edited/net/ipv4/netfilter/ip_queue.c	Fri Sep 24 02:15:45 2004
@@ -471,7 +471,9 @@
 		ipq_issue_verdict(entry, NF_DROP);
 }
 
-#define RCV_SKB_FAIL(err) do { netlink_ack(skb, nlh, (err)); return; } while (0)
+#define RCV_SKB_FAIL(err) do {					\
+	netlink_ack(skb, nlh, (err), GFP_ATOMIC); return; 	\
+	} while (0)						\
 
 static inline void
 ipq_rcv_skb(struct sk_buff *skb)
@@ -526,7 +528,7 @@
 		RCV_SKB_FAIL(status);
 		
 	if (flags & NLM_F_ACK)
-		netlink_ack(skb, nlh, 0);
+		netlink_ack(skb, nlh, 0, GFP_ATOMIC);
         return;
 }
 

[-- Attachment #7: netlink_ack-rtnetlink.patch --]
[-- Type: text/x-patch, Size: 442 bytes --]

===== net/core/rtnetlink.c 1.27 vs edited =====
--- 1.27/net/core/rtnetlink.c	Mon Sep 13 02:03:08 2004
+++ edited/net/core/rtnetlink.c	Fri Sep 24 02:02:05 2004
@@ -558,9 +558,9 @@
 			 */
 			if (err == 0)
 				return -1;
-			netlink_ack(skb, nlh, err);
+			netlink_ack(skb, nlh, err, GFP_KERNEL);
 		} else if (nlh->nlmsg_flags&NLM_F_ACK)
-			netlink_ack(skb, nlh, 0);
+			netlink_ack(skb, nlh, 0, GFP_KERNEL);
 		skb_pull(skb, rlen);
 	}
 

[-- Attachment #8: netlink_ack-tcp_diag.patch --]
[-- Type: text/x-patch, Size: 355 bytes --]

===== net/ipv4/tcp_diag.c 1.16 vs edited =====
--- 1.16/net/ipv4/tcp_diag.c	Tue Sep  7 18:18:04 2004
+++ edited/net/ipv4/tcp_diag.c	Fri Sep 24 02:02:05 2004
@@ -634,7 +634,7 @@
 			return;
 		err = tcpdiag_rcv_msg(skb, nlh);
 		if (err || nlh->nlmsg_flags & NLM_F_ACK) 
-			netlink_ack(skb, nlh, err);
+			netlink_ack(skb, nlh, err, GFP_KERNEL);
 	}
 }
 

[-- Attachment #9: netlink_ack-xfrm_user.patch --]
[-- Type: text/x-patch, Size: 436 bytes --]

===== net/xfrm/xfrm_user.c 1.48 vs edited =====
--- 1.48/net/xfrm/xfrm_user.c	Fri Sep 10 23:35:53 2004
+++ edited/net/xfrm/xfrm_user.c	Fri Sep 24 02:02:06 2004
@@ -995,7 +995,7 @@
 		if (xfrm_user_rcv_msg(skb, nlh, &err) < 0) {
 			if (err == 0)
 				return -1;
-			netlink_ack(skb, nlh, err);
+			netlink_ack(skb, nlh, err, GFP_KERNEL);
 		} else if (nlh->nlmsg_flags & NLM_F_ACK)
 			netlink_ack(skb, nlh, 0);
 		skb_pull(skb, rlen);

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

* Re: [NETLINK] netlink_ack takes gfp flag as parameter
  2004-09-24  1:12 [NETLINK] netlink_ack takes gfp flag as parameter Pablo Neira
@ 2004-09-24  2:12 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2004-09-24  2:12 UTC (permalink / raw)
  To: Pablo Neira; +Cc: netdev, davem

Pablo Neira <pablo@eurodev.net> wrote:
> 
> AFAIK ip_queue, ip6_queue and dn_rtmsg use netlink_ack in interrupt 
> context which calls alloc_skb with the GFP_KERNEL flag. This patch adds 
> a new parameter to netlink_ack to set the gfp flag.

Bogus.  All of those functions call netlink_ack in the context of the
sending process.
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2004-09-24  2:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-24  1:12 [NETLINK] netlink_ack takes gfp flag as parameter Pablo Neira
2004-09-24  2:12 ` 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).