[etherlab-dev] [PATCH] Fix kmalloc while holding read lock on dev_base_lock

Esben Haabendal eha at dev.doredevelopment.dk
Wed Mar 3 07:44:56 CET 2010


Hi

On Tue, 2010-02-16 at 16:12 +0100, Florian Pose wrote: 
> Hi,
> 
> On Fri, Feb 12, 2010 at 10:09:12AM +0100, Esben Haabendal wrote:
> > Using the ec_generic driver on a standard (ie. non RT_PREEMPT) 2.6.32
> > kernel BUGs out on the kmalloc in ec_gen_init_module().
> > It might be that this happens to work on UP RT_PREEMPT kernels, but
> > AFAIK, kmalloc while holdning rwlock should be GFP_ATOMIC.
> > 
> > /Esben
> 
> > Binary files etherlabmaster/.hg/dirstate and etherlabmaster.patched/.hg/dirstate differ
> > diff -urN etherlabmaster/devices/generic.c etherlabmaster.patched/devices/generic.c
> > --- etherlabmaster/devices/generic.c	2010-02-11 14:42:46.000000000 +0100
> > +++ etherlabmaster.patched/devices/generic.c	2010-02-12 09:04:49.000000000 +0100
> > @@ -408,7 +408,7 @@
> >      for_each_netdev(&init_net, netdev) {
> >          if (netdev->type != ARPHRD_ETHER)
> >              continue;
> > -        desc = kmalloc(sizeof(ec_gen_interface_desc_t), GFP_KERNEL);
> > +        desc = kmalloc(sizeof(ec_gen_interface_desc_t), GFP_ATOMIC);
> >          if (!desc) {
> >              ret = -ENOMEM;
> >              read_unlock(&dev_base_lock);
> 
> many thanks, I will fix it.

Have you found a different way to fix it?  AFAICS, the patch is not
applied to the current tip yet...

/Esben




More information about the etherlab-dev mailing list