All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "af_key: Fix slab-out-of-bounds in pfkey_compile_policy." has been added to the 4.4-stable tree
@ 2018-04-10  9:02 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2018-04-10  9:02 UTC (permalink / raw)
  To: steffen.klassert, alexander.levin, andreyknvl, gregkh
  Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    af_key: Fix slab-out-of-bounds in pfkey_compile_policy.

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     af_key-fix-slab-out-of-bounds-in-pfkey_compile_policy.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From foo@baz Tue Apr 10 10:31:53 CEST 2018
From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Fri, 5 May 2017 07:40:42 +0200
Subject: af_key: Fix slab-out-of-bounds in pfkey_compile_policy.

From: Steffen Klassert <steffen.klassert@secunet.com>


[ Upstream commit d90c902449a7561f1b1d58ba5a0d11728ce8b0b2 ]

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: df71837d502 ("[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>
---
 net/key/af_key.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3305,7 +3305,7 @@ static struct xfrm_policy *pfkey_compile
 		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;
 		}


Patches currently in stable-queue which might be from steffen.klassert@secunet.com are

queue-4.4/ipsec-check-return-value-of-skb_to_sgvec-always.patch
queue-4.4/skbuff-return-emsgsize-in-skb_to_sgvec-to-prevent-overflow.patch
queue-4.4/xfrm-fix-state-migration-copy-replay-sequence-numbers.patch
queue-4.4/af_key-fix-slab-out-of-bounds-in-pfkey_compile_policy.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-10  9:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10  9:02 Patch "af_key: Fix slab-out-of-bounds in pfkey_compile_policy." has been added to the 4.4-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.