Commit 6e296c9f authored by David S. Miller's avatar David S. Miller Committed by Stephen Hemminger

[IPV6]: Make sure errors propagate properly in {udp,raw} sendmsg.

parent 3111b920
......@@ -209,7 +209,6 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
int seg_len = skb->len;
int hlimit;
u32 mtu;
int err = 0;
if (opt) {
int head_room;
......
......@@ -659,7 +659,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
fl.oif = np->mcast_oif;
dst = ip6_dst_lookup(sk, &fl);
if (dst->error)
if ((err = dst->error))
goto out;
if (hlimit < 0) {
......
......@@ -811,8 +811,10 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
* The socket lock must be held while it's corked.
*/
lock_sock(sk);
if (likely(up->pending))
if (likely(up->pending)) {
dst = NULL;
goto do_append_data;
}
release_sock(sk);
}
ulen += sizeof(struct udphdr);
......@@ -929,7 +931,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
fl.oif = np->mcast_oif;
dst = ip6_dst_lookup(sk, &fl);
if (dst->error)
if ((err = dst->error))
goto out;
if (hlimit < 0) {
......@@ -968,9 +970,10 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
else if (!corkreq)
err = udp_v6_push_pending_frames(sk, up);
ip6_dst_store(sk, dst,
!ipv6_addr_cmp(&fl.fl6_dst, &np->daddr) ?
&np->daddr : NULL);
if (dst)
ip6_dst_store(sk, dst,
!ipv6_addr_cmp(&fl.fl6_dst, &np->daddr) ?
&np->daddr : NULL);
if (err > 0)
err = np->recverr ? net_xmit_errno(err) : 0;
release_sock(sk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment