]> www.infradead.org Git - users/jedix/linux-maple.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)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 26 May 2016 22:44:20 +0000 (15:44 -0700)
commit5b9c7737f787a24029dd1deb71d253c1857313e1
treed171d155f32ede5b4dc4f90e6412c6b96689d208
parent5e15db9cac910c5de62bf3f2e76335ba5f39a690
crypto: af_alg - Disallow bind/setkey/... after accept(2)

Orabug: 23330747

[ Upstream commit c840ac6af3f8713a71b4d2363419145760bd6044 ]

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>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit 0571ba52a19e18a1c20469454231eef681cb1310)

Signed-off-by: Dan Duval <dan.duval@oracle.com>
crypto/af_alg.c
include/crypto/if_alg.h