Skip to content

Commit

Permalink
IPv6: datagram_send_ctl() should exit immediately when an error occured
Browse files Browse the repository at this point in the history
When an error occured, datagram_send_ctl() should exit immediately rather than
continue to run the for loop. Otherwise, the variable err might be changed and
the error might be hidden.

Fix this bug by using "goto" instead of "break".

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Miao Xie authored and David S. Miller committed Jul 30, 2008
1 parent e93dc48 commit 4a36702
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv6/datagram.c
Original file line number Diff line number Diff line change
@@ -732,7 +732,7 @@ int datagram_send_ctl(struct net *net,
LIMIT_NETDEBUG(KERN_DEBUG "invalid cmsg type: %d\n",
cmsg->cmsg_type);
err = -EINVAL;
break;
goto exit_f;
}
}

0 comments on commit 4a36702

Please sign in to comment.