From owner-svn-src-projects@FreeBSD.ORG Thu May 19 21:16:46 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 656F21065672; Thu, 19 May 2011 21:16:46 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5539E8FC14; Thu, 19 May 2011 21:16:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4JLGkx8053558; Thu, 19 May 2011 21:16:46 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4JLGkO4053556; Thu, 19 May 2011 21:16:46 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <201105192116.p4JLGkO4053556@svn.freebsd.org> From: Ermal Luçi Date: Thu, 19 May 2011 21:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222104 - projects/pf/pf45/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 May 2011 21:16:46 -0000 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;