From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Jean Subject: [PATCH 2/2] ipt_hashlimit.c: sleeping function called from invalid context Date: Wed, 26 Jan 2005 22:51:51 -0500 Message-ID: <41F86557.2000208@cookinglinux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: netfilter-devel@lists.netfilter.org Return-path: To: Harald Welte List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: netfilter-devel-bounces@lists.netfilter.org Errors-To: netfilter-devel-bounces@lists.netfilter.org List-Id: netfilter-devel.vger.kernel.org Name: sleeping function called from invalid context Status: Tested under Linux 2.6.10 Signed-off-by: Samuel Jean When we cat our proc entries, we get: Jan 26 22:07:33 Workstation kernel: Debug: sleeping function called from invalid context at mm/slab.c:2055 Jan 26 22:07:33 Workstation kernel: in_atomic():1, irqs_disabled():0 Jan 26 22:07:33 Workstation kernel: [] __might_sleep+0xb0/0xe0 Jan 26 22:07:33 Workstation kernel: [] kmem_cache_alloc+0x6c/0x70 Jan 26 22:07:33 Workstation kernel: [] dl_seq_start+0x61/0x80 [ipt_hashlimit] Jan 26 22:07:33 Workstation kernel: [] seq_read+0xbf/0x2b0 Jan 26 22:07:33 Workstation kernel: [] vfs_read+0xb8/0x130 Jan 26 22:07:33 Workstation kernel: [] sys_read+0x51/0x80 Jan 26 22:07:33 Workstation kernel: [] syscall_call+0x7/0xb This incremental patch to the previous fixes it by disallowing kmalloc to sleep. --- net/ipv4/netfilter/ipt_hashlimit.c.orig 2005-01-26 22:35:43.000000000 -0500 +++ net/ipv4/netfilter/ipt_hashlimit.c 2005-01-26 22:36:14.000000000 -0500 @@ -570,7 +570,7 @@ static void *dl_seq_start(struct seq_fil if (*pos >= htable->cfg.size) return NULL; - bucket = kmalloc(sizeof(unsigned int), GFP_KERNEL); + bucket = kmalloc(sizeof(unsigned int), GFP_ATOMIC); if (!bucket) return ERR_PTR(-ENOMEM);