Patchwork [Open-FCoE,12/14] fipvlan: break out of receive loop on error

login
register
mail settings
Submitter Hannes Reinecke
Date Nov. 19, 2013, 12:26 p.m.
Message ID <1384863974-27096-13-git-send-email-hare@suse.de>
Download mbox | patch
Permalink /patch/126/
State Accepted
Headers show

Comments

Hannes Reinecke - Nov. 19, 2013, 12:26 p.m.
When fip_recv() returns an error we need to break out of the
receive loop; otherwise we might be stuck in there forever.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 fipvlan.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch

diff --git a/fipvlan.c b/fipvlan.c
index 3c91930..198f0ee 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -772,8 +772,12 @@  static void recv_loop(int timeout)
 			rtnl_recv(pfd[0].fd, rtnl_listener_handler, NULL);
 		/* everything else should be FIP packet sockets */
 		for (i = 1; i < pfd_len; i++) {
-			if (pfd[i].revents & POLLIN)
-				fip_recv(pfd[i].fd, fip_vlan_handler, NULL);
+			if (pfd[i].revents & POLLIN) {
+				rc = fip_recv(pfd[i].fd, fip_vlan_handler,
+					      NULL);
+				if (rc < 0)
+					break;
+			}
 		}
 	}
 }