2010-07-07 11:12:45 +00:00
|
|
|
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
|
|
|
|
Subject: [PATCH 19/31] netvm: filter emergency skbs.
|
|
|
|
Patch-mainline: not yet
|
|
|
|
|
|
|
|
Toss all emergency packets not for a SOCK_MEMALLOC socket. This ensures our
|
|
|
|
precious memory reserve doesn't get stuck waiting for user-space.
|
|
|
|
|
|
|
|
The correctness of this approach relies on the fact that networks must be
|
|
|
|
assumed lossy.
|
|
|
|
|
|
|
|
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
|
|
|
|
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
|
|
|
|
---
|
|
|
|
net/core/filter.c | 3 +++
|
|
|
|
1 file changed, 3 insertions(+)
|
|
|
|
|
|
|
|
--- a/net/core/filter.c
|
|
|
|
+++ b/net/core/filter.c
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -82,6 +82,9 @@ int sk_filter(struct sock *sk, struct sk
|
2010-07-07 11:12:45 +00:00
|
|
|
int err;
|
|
|
|
struct sk_filter *filter;
|
|
|
|
|
|
|
|
+ if (skb_emergency(skb) && !sk_has_memalloc(sk))
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
err = security_sock_rcv_skb(sk, skb);
|
|
|
|
if (err)
|
|
|
|
return err;
|