Date: Thu, 19 May 2011 21:16:46 +0000 (UTC) From: Ermal Luçi <eri@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r222104 - projects/pf/pf45/sys/contrib/pf/net Message-ID: <201105192116.p4JLGkO4053556@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105192116.p4JLGkO4053556>