mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
af_key: Fix slab-out-of-bounds in pfkey_compile_policy.
[ Upstream commitd90c902449] The sadb_x_sec_len is stored in the unit 'byte divided by eight'. So we have to multiply this value by eight before we can do size checks. Otherwise we may get a slab-out-of-bounds when we memcpy the user sec_ctx. Fixes:df71837d50("[LSM-IPSec]: Security association restriction.") Reported-by: Andrey Konovalov <andreyknvl@google.com> Tested-by: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8428496815
commit
a587acdbb0
@@ -3305,7 +3305,7 @@ static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt,
|
||||
p += pol->sadb_x_policy_len*8;
|
||||
sec_ctx = (struct sadb_x_sec_ctx *)p;
|
||||
if (len < pol->sadb_x_policy_len*8 +
|
||||
sec_ctx->sadb_x_sec_len) {
|
||||
sec_ctx->sadb_x_sec_len*8) {
|
||||
*dir = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user