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

Florian Pose fp at igh-essen.com
Tue Feb 16 16:12:32 CET 2010


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.

-- 
Best regards,
Florian Pose

http://etherlab.org


More information about the etherlab-dev mailing list