diff options
| -rw-r--r-- | net/ipv4/udp.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 544f435d1aff..ba9f137f5aa7 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -791,6 +791,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
| 791 | { | 791 | { |
| 792 | struct inet_sock *inet = inet_sk(sk); | 792 | struct inet_sock *inet = inet_sk(sk); |
| 793 | struct udp_sock *up = udp_sk(sk); | 793 | struct udp_sock *up = udp_sk(sk); |
| 794 | struct flowi4 fl4_stack; | ||
| 794 | struct flowi4 *fl4; | 795 | struct flowi4 *fl4; |
| 795 | int ulen = len; | 796 | int ulen = len; |
| 796 | struct ipcm_cookie ipc; | 797 | struct ipcm_cookie ipc; |
| @@ -919,17 +920,18 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
| 919 | if (connected) | 920 | if (connected) |
| 920 | rt = (struct rtable *)sk_dst_check(sk, 0); | 921 | rt = (struct rtable *)sk_dst_check(sk, 0); |
| 921 | 922 | ||
| 923 | fl4 = &inet->cork.fl.u.ip4; | ||
| 922 | if (rt == NULL) { | 924 | if (rt == NULL) { |
| 923 | struct flowi4 fl4; | ||
| 924 | struct net *net = sock_net(sk); | 925 | struct net *net = sock_net(sk); |
| 925 | 926 | ||
| 926 | flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos, | 927 | fl4 = &fl4_stack; |
| 928 | flowi4_init_output(fl4, ipc.oif, sk->sk_mark, tos, | ||
| 927 | RT_SCOPE_UNIVERSE, sk->sk_protocol, | 929 | RT_SCOPE_UNIVERSE, sk->sk_protocol, |
| 928 | inet_sk_flowi_flags(sk)|FLOWI_FLAG_CAN_SLEEP, | 930 | inet_sk_flowi_flags(sk)|FLOWI_FLAG_CAN_SLEEP, |
| 929 | faddr, saddr, dport, inet->inet_sport); | 931 | faddr, saddr, dport, inet->inet_sport); |
| 930 | 932 | ||
| 931 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); | 933 | security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); |
| 932 | rt = ip_route_output_flow(net, &fl4, sk); | 934 | rt = ip_route_output_flow(net, fl4, sk); |
| 933 | if (IS_ERR(rt)) { | 935 | if (IS_ERR(rt)) { |
| 934 | err = PTR_ERR(rt); | 936 | err = PTR_ERR(rt); |
| 935 | rt = NULL; | 937 | rt = NULL; |
| @@ -950,9 +952,9 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
| 950 | goto do_confirm; | 952 | goto do_confirm; |
| 951 | back_from_confirm: | 953 | back_from_confirm: |
| 952 | 954 | ||
| 953 | saddr = rt->rt_src; | 955 | saddr = fl4->saddr; |
| 954 | if (!ipc.addr) | 956 | if (!ipc.addr) |
| 955 | daddr = ipc.addr = rt->rt_dst; | 957 | daddr = ipc.addr = fl4->daddr; |
| 956 | 958 | ||
| 957 | /* Lockless fast path for the non-corking case. */ | 959 | /* Lockless fast path for the non-corking case. */ |
| 958 | if (!corkreq) { | 960 | if (!corkreq) { |
