Skip to content

Commit 06dc94b

Browse files
committed
ipv4: Fix crash in dst_release when udp_sendmsg route lookup fails.
As reported by Eric: [11483.697233] IP: [<c12b0638>] dst_release+0x18/0x60 ... [11483.697741] Call Trace: [11483.697764] [<c12fc9d2>] udp_sendmsg+0x282/0x6e0 [11483.697790] [<c12a1c01>] ? memcpy_toiovec+0x51/0x70 [11483.697818] [<c12dbd90>] ? 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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1558310 commit 06dc94b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/ipv4/udp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
925925
rt = ip_route_output_flow(net, &fl, sk);
926926
if (IS_ERR(rt)) {
927927
err = PTR_ERR(rt);
928+
rt = NULL;
928929
if (err == -ENETUNREACH)
929930
IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES);
930931
goto out;

0 commit comments

Comments
 (0)