DragonFly BSD
DragonFly commits List (threaded) for 2005-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/sys/netinet sctp_input.c

From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 11 Aug 2005 10:30:06 -0700 (PDT)

:This function is being called from sctp_input() with a critical section 
:held, so I doubt you are right.  Common code I saw always uses M_NOWAIT 
:and treats NULL as a failure.
:Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\

    I think Joerg is right... the functionality of the code should 
    not be changed in cases where we do not completely understand the
    context in which the code operates.

    In this case the code clearly has a bug... it is calling MALLOC 
    with M_NOWAIT and not bothering to check for a NULL result.  The
    original code clearly intends the malloc to succeed, and we have
    no idea what to do if it didn't, so that M_NOWAIT should be changed
    to M_INTWAIT for now.  It's better to do it this way then change
    the code paths and have to track down weird bugs n the sctp state
    later on.

    There is a great deal of code inherited from FreeBSD that made 
    similar assumptions and I would not be surprised if the misuse of
    malloc has migrated to other projects.  In FreeBSD, M_NOWAIT mallocs
    usually do not fail and these cases tend to slide by.  But in DragonFly
    M_NOWAIT mallocs can easily fail.

					Matthew Dillon 

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]