Skip to content
Permalink
Browse files Browse the repository at this point in the history
net: fix cipso packet validation when !NETLABEL
When CONFIG_NETLABEL is disabled, the cipso_v4_validate() function could loop
forever in the main loop if opt[opt_iter +1] == 0, this will causing a kernel
crash in an SMP system, since the CPU executing this function will
stall /not respond to IPIs.

This problem can be reproduced by running the IP Stack Integrity Checker
(http://isic.sourceforge.net) using the following command on a Linux machine
connected to DUT:

"icmpsic -s rand -d <DUT IP address> -r 123456"
wait (1-2 min)

Signed-off-by: Seif Mazareeb <seif@marvell.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Seif Mazareeb authored and davem330 committed Oct 19, 2013
1 parent 90c6bd3 commit f2e5ddc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/net/cipso_ipv4.h
Expand Up @@ -290,6 +290,7 @@ static inline int cipso_v4_validate(const struct sk_buff *skb,
unsigned char err_offset = 0;
u8 opt_len = opt[1];
u8 opt_iter;
u8 tag_len;

if (opt_len < 8) {
err_offset = 1;
Expand All @@ -302,11 +303,12 @@ static inline int cipso_v4_validate(const struct sk_buff *skb,
}

for (opt_iter = 6; opt_iter < opt_len;) {
if (opt[opt_iter + 1] > (opt_len - opt_iter)) {
tag_len = opt[opt_iter + 1];
if ((tag_len == 0) || (opt[opt_iter + 1] > (opt_len - opt_iter))) {
err_offset = opt_iter + 1;
goto out;
}
opt_iter += opt[opt_iter + 1];
opt_iter += tag_len;
}

out:
Expand Down

0 comments on commit f2e5ddc

Please sign in to comment.