aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/datagram.c2
-rw-r--r--net/ipv6/ipv6_sockglue.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 99a6eb23378b..3b55b4c8e2d1 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -696,7 +696,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
696 } 696 }
697 697
698 tc = *(int *)CMSG_DATA(cmsg); 698 tc = *(int *)CMSG_DATA(cmsg);
699 if (tc < 0 || tc > 0xff) 699 if (tc < -1 || tc > 0xff)
700 goto exit_f; 700 goto exit_f;
701 701
702 err = 0; 702 err = 0;
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 43327264e69c..a5eaaf693abf 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -362,7 +362,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
362 break; 362 break;
363 363
364 case IPV6_TCLASS: 364 case IPV6_TCLASS:
365 if (val < 0 || val > 0xff) 365 if (val < -1 || val > 0xff)
366 goto e_inval; 366 goto e_inval;
367 np->tclass = val; 367 np->tclass = val;
368 retv = 0; 368 retv = 0;
@@ -947,6 +947,8 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
947 947
948 case IPV6_TCLASS: 948 case IPV6_TCLASS:
949 val = np->tclass; 949 val = np->tclass;
950 if (val < 0)
951 val = 0;
950 break; 952 break;
951 953
952 case IPV6_RECVTCLASS: 954 case IPV6_RECVTCLASS: