incomplete cleanup after failed vmapbuf() in cam_periph_mapmem()

Tor.Egge at cvsup.no.freebsd.org Tor.Egge at cvsup.no.freebsd.org
Thu Mar 27 16:27:45 PST 2003


The cleanup after a failed vmapbuf() in cam_periph_mapmem() seems to
be incomplete.  Buffers that have already been successfully mapped are
not unmapped before being released.  The buffer that could not be
mapped is not released.

A suggested fix is enclosed.

- Tor Egge
-------------- next part --------------
Index: sys/cam/cam_periph.c
===================================================================
RCS file: /home/ncvs/src/sys/cam/cam_periph.c,v
retrieving revision 1.47
diff -u -r1.47 cam_periph.c
--- sys/cam/cam_periph.c	15 Mar 2003 21:59:05 -0000	1.47
+++ sys/cam/cam_periph.c	28 Mar 2003 00:17:37 -0000
@@ -675,9 +675,12 @@
 				(u_long)lengths[i]);
 			for (j = 0; j < i; ++j) {
 				*data_ptrs[j] = mapinfo->bp[j]->b_saveaddr;
+				vunmapbuf(mapinfo->bp[j]);
 				mapinfo->bp[j]->b_flags &= ~B_PHYS;
 				relpbuf(mapinfo->bp[j], NULL);
 			}
+			mapinfo->bp[i]->b_flags &= ~B_PHYS;
+			relpbuf(mapinfo->bp[i], NULL);
 			PRELE(curproc);
 			return(EACCES);
 		}


More information about the freebsd-scsi mailing list