]> git.hungrycats.org Git - linux/commit
af_key: Add lock to key dump
authorYuejie Shi <syjcnss@gmail.com>
Fri, 31 Mar 2017 07:10:20 +0000 (15:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Aug 2017 02:19:38 +0000 (19:19 -0700)
commitb627f60019489332a47ae9028c4891b4ed563f23
tree32769730dc3d5f45a97084c7e7548f646af59c31
parente058f634852d0d2a2c16e62a19373817ac2ffeb4
af_key: Add lock to key dump

commit 89e357d83c06b6fac581c3ca7f0ee3ae7e67109e upstream.

A dump may come in the middle of another dump, modifying its dump
structure members. This race condition will result in NULL pointer
dereference in kernel. So add a lock to prevent that race.

Fixes: 83321d6b9872 ("[AF_KEY]: Dump SA/SP entries non-atomically")
Signed-off-by: Yuejie Shi <syjcnss@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/key/af_key.c