[Bug 445] New: ipt_account reports: sleeping function called from invalid context at mm/slab.c:2063

bugzilla-daemon at bugzilla.netfilter.org bugzilla-daemon at bugzilla.netfilter.org
Thu Feb 9 10:25:55 CET 2006


https://bugzilla.netfilter.org/bugzilla/show_bug.cgi?id=445

           Summary: ipt_account reports: sleeping function called from
                    invalid context at mm/slab.c:2063
           Product: netfilter/iptables
           Version: patch-o-matic-ng
          Platform: All
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ip_tables (kernel)
        AssignedTo: laforge at netfilter.org
        ReportedBy: jafo at tummy.com


The current ipt_account SVN code (and probably earlier, extending back as far as
July of 2005) seem to report the following when you read from the
/proc/net/ipt_account file:

Debug: sleeping function called from invalid context at mm/slab.c:2063
in_atomic():1[expected: 0], irqs_disabled():0

Call Trace:<ffffffff80131dd7>{__might_sleep+173}
<ffffffff8015fcab>{kmem_cache_alloc+34} 
       <ffffffffa01b7130>{:ipt_account:account_seq_start+51} 
       <ffffffff80193624>{seq_read+235} <ffffffff801770bf>{vfs_read+207} 
       <ffffffff80177316>{sys_read+69} <ffffffff80110092>{system_call+126} 


If I move the kmalloc and kfree in account_seq_start and account_seq_stop to
outside the spin-lock, these messages go away.  I don't see that the lock does
anything to protect the malloc/free.  My changed version of these functions are:

static void *account_seq_start(struct seq_file *s, loff_t *pos)
{
   struct proc_dir_entry *pde = s->private;
   struct t_ipt_account_table *table = pde->data;

   unsigned int *bucket;
  
   bucket = kmalloc(sizeof(unsigned int), GFP_KERNEL);
   if (!bucket)
      return ERR_PTR(-ENOMEM);

   spin_lock_bh(&table->ip_list_lock);
   if (*pos >= table->count)
      return NULL;

   *bucket = *pos;
   return bucket;
}

static void account_seq_stop(struct seq_file *s, void *v)
{
   struct proc_dir_entry *pde = s->private;
   struct t_ipt_account_table *table = pde->data;
   unsigned int *bucket = (unsigned int *)v;
   spin_unlock_bh(&table->ip_list_lock);
   kfree(bucket);
}

-- 
Configure bugmail: https://bugzilla.netfilter.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.



More information about the netfilter-buglog mailing list