]> err.no Git - linux-2.6/commitdiff
[IPV6]: Fix for ipv6_setsockopt NULL dereference
authorOlaf Kirch <olaf.kirch@oracle.com>
Fri, 9 Mar 2007 21:55:38 +0000 (13:55 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Mar 2007 21:55:38 +0000 (13:55 -0800)
I came across this bug in http://bugzilla.kernel.org/show_bug.cgi?id=8155

Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ipv6_sockglue.c

index 4e0561a082d0c0cda04faf7532f1eb9bbde76914..b82333b9228fdb6e405351cfe32ad6f431cc62a6 100644 (file)
@@ -413,7 +413,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
                }
 
                /* routing header option needs extra check */
-               if (optname == IPV6_RTHDR && opt->srcrt) {
+               if (optname == IPV6_RTHDR && opt && opt->srcrt) {
                        struct ipv6_rt_hdr *rthdr = opt->srcrt;
                        switch (rthdr->type) {
                        case IPV6_SRCRT_TYPE_0: