• Herbert Xu's avatar
    crypto: af_alg - Disallow bind/setkey/... after accept(2) · c840ac6a
    Herbert Xu authored
    Each af_alg parent socket obtained by socket(2) corresponds to a
    tfm object once bind(2) has succeeded.  An accept(2) call on that
    parent socket creates a context which then uses the tfm object.
    
    Therefore as long as any child sockets created by accept(2) exist
    the parent socket must not be modified or freed.
    
    This patch guarantees this by using locks and a reference count
    on the parent socket.  Any attempt to modify the parent socket will
    fail with EBUSY.
    
    Cc: stable@vger.kernel.org
    Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    c840ac6a
if_alg.h 2.35 KB