patch-2.2.16 linux/net/appletalk/aarp.c

Next file: linux/net/appletalk/ddp.c
Previous file: linux/mm/vmscan.c
Back to the patch index
Back to the overall index

diff -urN v2.2.15/linux/net/appletalk/aarp.c linux/net/appletalk/aarp.c
@@ -486,6 +486,8 @@
 
 void aarp_probe_network(struct atalk_iface *atif)
 {
+	struct device *dev = atif->dev;
+
 	if(atif->dev->type == ARPHRD_LOCALTLK || atif->dev->type == ARPHRD_PPP)
 		aarp_send_probe_phase1(atif);
 	else
@@ -501,6 +503,13 @@
 			current->state = TASK_INTERRUPTIBLE;
 			schedule_timeout(HZ/10);
 							
+			/*
+			 * our atif may no longer be valid, if the device
+			 * was brought down while we waited!
+			 */
+			if (atalk_find_dev(dev) != atif)
+				return;
+						
 			if (atif->status & ATIF_PROBE_FAIL)
 				break;
 		}
@@ -512,6 +521,7 @@
 	struct	aarp_entry	*entry;
 	unsigned int count;
 	int	hash;
+	struct device *dev = atif->dev;
 	
 	/*
 	 * we don't currently support LocalTalk or PPP for proxy AARP;
@@ -550,6 +560,13 @@
 		 */
 		current->state = TASK_INTERRUPTIBLE;
 		schedule_timeout(HZ/10);
+		
+		/*
+		 * our atif may no longer be valid, if the device was brought
+		 * down while we waited!
+		 */
+		if (atalk_find_dev(dev) != atif)
+			return -ENODEV;
 						
 		if (entry->status & ATIF_PROBE_FAIL)
 			break;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)