Skip to contentSkip to conversation

IPv6: datagram_send_ctl() should exit immediately when an error occured

PATCH Applied Miao Xie 2 participants 2 messages Jul 30, 2008

Subsystems (2)
lore
Share & tools
lore

Miao Xie

author
#0 lore raw

PATCH 1/1 IPv6: datagram_send_ctl() should exit immediately when an error occured

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".

---
 net/ipv6/datagram.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv6/datagram.c +1 -1
index f7b535d..410046a 100644
@@ -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;
 		}
 	}
 
Signature · 1 line
1.5.4.rc3
maintainer Applied
#1 lore raw

From: Miao Xie <[email protected]>
Date: Wed, 30 Jul 2008 09:30:43 +0800

Quoted 7 lines

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".

Applied, thanks.