diff options
author | David S. Miller <davem@davemloft.net> | 2007-03-25 23:27:59 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:23:45 -0400 |
commit | fc910a27839584209726537698b596576940add4 (patch) | |
tree | e03b021dcb5046ffb1e8154f0f4d4bc72c4c1c1d /include/linux/netlink.h | |
parent | ca043569390c528de4cd5ec9e07502f2bf4ecd1f (diff) |
[NETLINK]: Limit NLMSG_GOODSIZE to 8K.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netlink.h')
-rw-r--r-- | include/linux/netlink.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 2a20f488ac1b..a9d3ad5bc80f 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -171,9 +171,16 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); | |||
171 | 171 | ||
172 | /* | 172 | /* |
173 | * skb should fit one page. This choice is good for headerless malloc. | 173 | * skb should fit one page. This choice is good for headerless malloc. |
174 | * But we should limit to 8K so that userspace does not have to | ||
175 | * use enormous buffer sizes on recvmsg() calls just to avoid | ||
176 | * MSG_TRUNC when PAGE_SIZE is very large. | ||
174 | */ | 177 | */ |
175 | #define NLMSG_GOODORDER 0 | 178 | #if PAGE_SIZE < 8192UL |
176 | #define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER)) | 179 | #define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(PAGE_SIZE) |
180 | #else | ||
181 | #define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(8192UL) | ||
182 | #endif | ||
183 | |||
177 | #define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) | 184 | #define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) |
178 | 185 | ||
179 | 186 | ||