⬢ DragonFlyBSD Kernel Audit
DF-3516 / fix.diff
← back to finding ↓ download raw
--- a/sys/netgraph/socket/ng_socket.c
+++ b/sys/netgraph/socket/ng_socket.c
@@ -216,6 +216,10 @@
 		error = EINVAL;
 		goto release;
 	}
+	if (pcbp->sockdata == NULL) {		/* node already shut down */
+		error = ENOTCONN;
+		goto release;
+	}
 #ifdef	NOTYET
 	if (control && (error = ng_internalize(control, p))) {
 		if (pcbp->sockdata == NULL) {
@@ -685,6 +689,10 @@
 	node_p farnode;
 	int rtn, error;
 
+	if (sockdata == NULL) {			/* node already shut down */
+		TRAP_ERROR;
+		return (ENOTCONN);
+	}
 	sap = (struct sockaddr_ng *) nam;
 	rtn = ng_path_parse(sap->sg_data, &node, NULL, &hook);
 	if (rtn < 0 || node == NULL || hook == NULL) {