From: David S. Miller Date: Thu, 3 Mar 2011 18:38:01 +0000 (-0800) Subject: ipv4: Fix crash in dst_release when udp_sendmsg route lookup fails. X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=06dc94b1ed05f91e246315afeb1c652d6d0dc9ab;p=linux-beck.git ipv4: Fix crash in dst_release when udp_sendmsg route lookup fails. As reported by Eric: [11483.697233] IP: [] dst_release+0x18/0x60 ... [11483.697741] Call Trace: [11483.697764] [] udp_sendmsg+0x282/0x6e0 [11483.697790] [] ? memcpy_toiovec+0x51/0x70 [11483.697818] [] ? ip_generic_getfrag+0x0/0xb0 The pointer passed to dst_release() is -EINVAL, that's because we leave an error pointer in the local variable "rt" by accident. NULL it out to fix the bug. Reported-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 95e0c2c194a1..c9a73e5b26a3 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -925,6 +925,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, rt = ip_route_output_flow(net, &fl, sk); if (IS_ERR(rt)) { err = PTR_ERR(rt); + rt = NULL; if (err == -ENETUNREACH) IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); goto out;