Hi
Please update from svn: this problem should already be fixed

Luca



On 04/apr/2011, at 12:33, 王勇 <[email protected]> wrote:

> Dear all,
> 
> I am a newbie to pf ring and kernel program. I added several lines follow the 
> calling of add_skb_to_ring in pf_ring/kernel/pf_ring.c to do something extra 
> I need. It looks like:
> 
> 
> 
> from line 2556 fo kernel/pf_ring.c
> 
> 
> 
>    if((pfr != NULL)
>       && (pfr->ring_netdev != &none_dev) /* Not a dummy socket bound to 
> "none" */
>       && (pfr->cluster_id == 0 /* No cluster */ )
>       && (pfr->ring_slots != NULL)
>       && is_valid_skb_direction(pfr->direction, recv_packet)
>       && ((pfr->ring_netdev == skb->dev)
>    || (pfr->ring_netdev == &any_dev) /* Socket bound to 'any' */
>    || ((skb->dev->flags & IFF_SLAVE) && (pfr->ring_netdev == 
> skb->dev->master)))) {
>      /* We've found the ring where the packet can be stored */
>      int old_caplen = hdr.caplen;  /* Keep old lenght */
>      hdr.caplen = min(hdr.caplen, pfr->bucket_len);
>      add_skb_to_ring(skb, pfr, &hdr, is_ip_pkt, displ, channel_id, 
> num_rx_channels);
> 
>      my_function_here(skb);
>      hdr.caplen = old_caplen;
>      rc = 1; /* Ring found: we've done our job */
>    }
> 
> 
> 
> In my_function_here(), I just kmalloc some byte with GFP_KERNEL and the kfree 
> it. When I run this code, the kernel always crashes with message:BUG: 
> scheduling while atomic
> 
> I think this is because kmalloc with GFP_KERNEL, but I noticed that in 
> add_skb_to_ring() there is kcalloc with GFP_KERNEL! Why this is safe and my 
> code cause kernel crash? 
> 
> 
> 
> Thank you for your time!
> _______________________________________________
> Ntop-misc mailing list
> [email protected]
> http://listgateway.unipi.it/mailman/listinfo/ntop-misc
_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc

Reply via email to