Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756571Ab0GMKVN (ORCPT ); Tue, 13 Jul 2010 06:21:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6948 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756524Ab0GMKVG (ORCPT ); Tue, 13 Jul 2010 06:21:06 -0400 Date: Tue, 13 Jul 2010 06:20:15 -0400 From: Xiaotian Feng To: linux-mm@kvack.org, linux-nfs@vger.kernel.org, netdev@vger.kernel.org Cc: riel@redhat.com, cl@linux-foundation.org, a.p.zijlstra@chello.nl, Xiaotian Feng , linux-kernel@vger.kernel.org, lwang@redhat.com, penberg@cs.helsinki.fi, akpm@linux-foundation.org, davem@davemloft.net Message-Id: <20100713102014.2835.75027.sendpatchset@danny.redhat> In-Reply-To: <20100713101650.2835.15245.sendpatchset@danny.redhat> References: <20100713101650.2835.15245.sendpatchset@danny.redhat> Subject: [PATCH -mmotm 18/30] netvm: filter emergency skbs Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1312 Lines: 40 >From b0240dd1e2ee0b4dc30f98c67cfe35e8c1833753 Mon Sep 17 00:00:00 2001 From: Xiaotian Feng Date: Tue, 13 Jul 2010 11:36:53 +0800 Subject: [PATCH 18/30] netvm: filter emergency skbs. 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 Signed-off-by: Suresh Jayaraman Signed-off-by: Xiaotian Feng --- net/core/filter.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index 52b051f..bdcbc14 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -82,6 +82,9 @@ int sk_filter(struct sock *sk, struct sk_buff *skb) 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; -- 1.7.1.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/