]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: af_alg - Disallow bind/setkey/... after accept(2)
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 30 Dec 2015 03:47:53 +0000 (11:47 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 18 Jan 2016 10:16:09 +0000 (18:16 +0800)
commit0606b4a6730345fb701e62a44c48a9f9dc125409
treec2b3d5d10f5c7eccaec249337e6c3b8821567662
parentff8ca65ae92acd11e9fde662ec0463dd1b2691ce
crypto: af_alg - Disallow bind/setkey/... after accept(2)

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: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/af_alg.c
include/crypto/if_alg.h