Commit d0cf313d authored by yujuan.qi's avatar yujuan.qi Committed by Kleber Sacilotto de Souza

Cipso: cipso_v4_optptr enter infinite loop

BugLink: https://bugs.launchpad.net/bugs/1792392

commit 40413955 upstream.

in for(),if((optlen > 0) && (optptr[1] == 0)), enter infinite loop.

Test: receive a packet which the ip length > 20 and the first byte of ip option is 0, produce this issue
Signed-off-by: default avataryujuan.qi <yujuan.qi@mediatek.com>
Acked-by: default avatarPaul Moore <paul@paul-moore.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 09a241aa
...@@ -1593,9 +1593,17 @@ unsigned char *cipso_v4_optptr(const struct sk_buff *skb) ...@@ -1593,9 +1593,17 @@ unsigned char *cipso_v4_optptr(const struct sk_buff *skb)
int taglen; int taglen;
for (optlen = iph->ihl*4 - sizeof(struct iphdr); optlen > 0; ) { for (optlen = iph->ihl*4 - sizeof(struct iphdr); optlen > 0; ) {
if (optptr[0] == IPOPT_CIPSO) switch (optptr[0]) {
case IPOPT_CIPSO:
return optptr; return optptr;
taglen = optptr[1]; case IPOPT_END:
return NULL;
case IPOPT_NOOP:
taglen = 1;
break;
default:
taglen = optptr[1];
}
optlen -= taglen; optlen -= taglen;
optptr += taglen; optptr += taglen;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment