svn commit: r222104 - projects/pf/pf45/sys/contrib/pf/net

Ermal Luçi eri at FreeBSD.org
Thu May 19 21:16:46 UTC 2011


Author: eri
Date: Thu May 19 21:16:46 2011
New Revision: 222104
URL: http://svn.freebsd.org/changeset/base/222104

Log:
  Prevent allocationg memory with locks held.

Modified:
  projects/pf/pf45/sys/contrib/pf/net/pf_ioctl.c

Modified: projects/pf/pf45/sys/contrib/pf/net/pf_ioctl.c
==============================================================================
--- projects/pf/pf45/sys/contrib/pf/net/pf_ioctl.c	Thu May 19 20:35:40 2011	(r222103)
+++ projects/pf/pf45/sys/contrib/pf/net/pf_ioctl.c	Thu May 19 21:16:46 2011	(r222104)
@@ -3414,10 +3414,21 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a
 			error = ENODEV;
 			goto fail;
 		}
+#ifdef __FreeBSD__
+		PF_UNLOCK();
+#endif
 		ioe = malloc(sizeof(*ioe), M_TEMP, M_WAITOK);
 		table = malloc(sizeof(*table), M_TEMP, M_WAITOK);
+#ifdef __FreeBSD__
+		PF_LOCK();
+#endif
 		for (i = 0; i < io->size; i++) {
+#ifdef __FreeBSD__
+		PF_COPYIN(io->array+i, ioe, sizeof(*ioe), error);
+		if (error) {
+#else
 			if (copyin(io->array+i, ioe, sizeof(*ioe))) {
+#endif
 				free(table, M_TEMP);
 				free(ioe, M_TEMP);
 				error = EFAULT;


More information about the svn-src-projects mailing list