DragonFlyBSD Kernel Audit
DF-1828 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/disk/iscsi/initiator/isc_soc.c b/sys/dev/disk/iscsi/initiator/isc_soc.c
--- a/sys/dev/disk/iscsi/initiator/isc_soc.c
+++ b/sys/dev/disk/iscsi/initiator/isc_soc.c
@@ -537,11 +537,13 @@
 	  /*
 	   | now read the rest.
 	   */
-	  pq = pdu_alloc(sp->isc, M_NOWAIT);
+	  pq = pdu_alloc(sp->isc, M_WAITOK);
 	  if(pq == NULL) { // XXX: might cause a deadlock ...
 	       debug(3, "out of pdus, wait");
-	       pq = pdu_alloc(sp->isc, M_NOWAIT);  // OK to WAIT
+	       pq = pdu_alloc(sp->isc, M_WAITOK);  // OK to WAIT
 	  }
+	  if (pq == NULL)
+	       return ENOBUFS;
 	  pq->pdu.ipdu.bhs = sp->bhs;
 	  pq->len = sizeof(bhs_t);	// so far only the header was read
 	  error = so_recv(sp, pq);