Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-03-30 08:56:24 +0200
committerTakashi Iwai <tiwai@suse.de>2017-03-30 08:56:24 +0200
commit221538e353278203270c642aaaffe62032d75ebd (patch)
treed74a493ce9e02823ce105f5bcc83b46fd64893fd
parent8d763fc9ae97c2ee6192e9cfbea4a7fd7734abef (diff)
parentd93945bce849793b510007e0faed2843af5e0260 (diff)
Merge branch 'SLE12-SP2' into SLE12-SP3rpm-4.4.57-1
Conflicts: series.conf suse-commit: 077b9af2b01def4b54f1ea68d7d9f9dcbf97bd18
-rw-r--r--net/xfrm/xfrm_user.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 805681a7d356..7de612deb39b 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -409,10 +409,20 @@ static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_es
if (!replay_esn || !rp)
return 0;
+ if (nla_len(rp) < sizeof(*up))
+ return -EINVAL;
+
up = nla_data(rp);
ulen = xfrm_replay_state_esn_len(up);
- if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen)
+ /* Check the overall length and the internal bitmap length to avoid
+ * potential overflow. */
+ if (nla_len(rp) < ulen ||
+ xfrm_replay_state_esn_len(replay_esn) != ulen ||
+ replay_esn->bmp_len != up->bmp_len)
+ return -EINVAL;
+
+ if (up->replay_window > up->bmp_len * sizeof(__u32) * 8)
return -EINVAL;
return 0;