Skip to contentSkip to conversation

Patch "xfrm: NULL dereference on allocation failure" has been added to the 4.11-stable tree

PATCH [email protected] 1 participant 1 message Jul 3, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

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

xfrm: NULL dereference on allocation failure

to the 4.11-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:
xfrm-null-dereference-on-allocation-failure.patch
and it can be found in the queue-4.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From e747f64336fc15e1c823344942923195b800aa1e Mon Sep 17 00:00:00 2001

From: Dan Carpenter <[email protected]>
Date: Wed, 14 Jun 2017 13:35:37 +0300
Subject: xfrm: NULL dereference on allocation failure

From: Dan Carpenter <[email protected]>

commit e747f64336fc15e1c823344942923195b800aa1e upstream.

The default error code in pfkey_msg2xfrm_state() is -ENOBUFS. We added a new call to security_xfrm_state_alloc() which sets "err" to zero so there several places where we can return ERR_PTR(0) if kmalloc() fails. The caller is expecting error pointers so it leads to a NULL dereference.

Fixes df71837d5024 ("[LSM-IPSec]: Security association restriction.")
---
 net/key/af_key.c |    1 +
 1 file changed, 1 insertion(+)
net/key/af_key.c +1 -0
@@ -1157,6 +1157,7 @@ static struct xfrm_state * pfkey_msg2xfr
 			goto out;
 	}
 
+	err = -ENOBUFS;
 	key = ext_hdrs[SADB_EXT_KEY_AUTH - 1];
 	if (sa->sadb_sa_auth) {
 		int keysize = 0;

Patches currently in stable-queue which might be from [email protected] are

queue-4.11/xfrm-oops-on-error-in-pfkey_msg2xfrm_state.patch queue-4.11/xfrm-null-dereference-on-allocation-failure.patch