From: wangweidong Date: Thu, 26 Dec 2013 05:55:56 +0000 (+0800) Subject: sctp: move skb_dst_set() a bit downwards in sctp_packet_transmit() X-Git-Tag: MMI-PSA29.97-13-9~12877^2~344 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0438816efd86c764d5544bf52e769604062316b3;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git sctp: move skb_dst_set() a bit downwards in sctp_packet_transmit() skb_dst_set will use dst, if dst is NULL although is not a problem, then goto the 'no_route' and free nskb, so do the skb_dst_set is pointless. so move the skb_dst_set after dst check. Remove the unnecessary initialization as well. v2: fix the subject line because it would confuse people, as pointed out by Daniel. Signed-off-by: Wang Weidong Signed-off-by: David S. Miller --- diff --git a/net/sctp/output.c b/net/sctp/output.c index b971cd226cf5..0f4d15fc2627 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c @@ -387,7 +387,7 @@ int sctp_packet_transmit(struct sctp_packet *packet) int err = 0; int padding; /* How much padding do we need? */ __u8 has_data = 0; - struct dst_entry *dst = tp->dst; + struct dst_entry *dst; unsigned char *auth = NULL; /* pointer to auth in skb data */ pr_debug("%s: packet:%p\n", __func__, packet); @@ -420,9 +420,9 @@ int sctp_packet_transmit(struct sctp_packet *packet) } } dst = dst_clone(tp->dst); - skb_dst_set(nskb, dst); if (!dst) goto no_route; + skb_dst_set(nskb, dst); /* Build the SCTP header. */ sh = (struct sctphdr *)skb_push(nskb, sizeof(struct sctphdr));