ipv4: make ip_append_data() handle NULL routing table
authorJulien TINNES <julien@cr0.org>
Thu, 27 Aug 2009 13:26:58 +0000 (15:26 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 9 Sep 2009 03:34:04 +0000 (20:34 -0700)
commit 788d908f2879a17e5f80924f3da2e23f1034482d upstream.

Add a check in ip_append_data() for NULL *rtp to prevent future bugs in
callers from being exploitable.

Signed-off-by: Julien Tinnes <julien@cr0.org>
Signed-off-by: Tavis Ormandy <taviso@sdf.lonestar.org>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/ipv4/ip_output.c

index 3e7e910c7c0fd6f229a9ee67a10936f24db36a3f..d1d88e6255bc0a2d4525246e5ccb01b80db7cb08 100644 (file)
@@ -814,6 +814,8 @@ int ip_append_data(struct sock *sk,
                        inet->cork.addr = ipc->addr;
                }
                rt = *rtp;
+               if (unlikely(!rt))
+                       return -EFAULT;
                /*
                 * We steal reference to this route, caller should not release it
                 */