[quagga-dev 3781] Re: Kernel Panic in memory allocation for RFC2385 patch

Sylvain Vittecoq svittecoq at gmail.com
Tue Nov 1 04:04:21 GMT 2005


The allocation of MD5 Digest for BGP Sessions is done inside the crypto module
which is not interrupt safe (Most allocations are performed with  GFP_KERNEL).

So let me know if I should not consider fixing the crypto module to
make it interrupt safe:

I would like to replace all GFP_KERNEL references in the crypto module with
a static to make sure we use GFP_ATOMIC whenever we are allocating
some memory in the context of an interrupt:

static inline int gfp_flag(void)
    return in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;

By the way, is in_interrupt() an expensive call ?



On 10/28/05, Christian Ehrhardt <quagga at c--e.de> wrote:
> Hi,
> On Thu, Oct 27, 2005 at 02:48:56PM -0400, Sylvain Vittecoq wrote:
> > If flags is GFP_KERNEL and in_interrupt() is true which I assume could be
> > the case
> > when we process some TCP Packets then we will hit the BUG
> > because the allocation should only be performed for flags __GFP_HIGH ...
> >
> > Am I missing anything here ?
> I don't know how much of the tcp-stack is done in interrupt context but
> doing GFP_KERNEL allocations from an interrupt is definitely a bug und
> the code doing this must be fixed.
> > Should this test be relaxed or should we force a different type of
> No the BUG test is ok.
> > allocation in the
> > computation of Md5 keys for TCP Packets ?
> Probably. Try to use GFP_ATOMIC but keep in mind that GFP_ATOMIC allocation
> may return NULL if there is no memory availiable.
>     regards   Christian

Sylvain Vittecoq
1151 North 3rd Street Apt 408
Philadelphia, 19123 PA USA
Cell : 1 215 290 2632

More information about the Quagga-dev mailing list