From owner-svn-src-head@FreeBSD.ORG Wed Dec 19 12:00:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 708C08F2; Wed, 19 Dec 2012 12:00:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3B6108FC0A; Wed, 19 Dec 2012 12:00:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBJC0Ar2087313; Wed, 19 Dec 2012 12:00:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBJC0AJO087312; Wed, 19 Dec 2012 12:00:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212191200.qBJC0AJO087312@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 19 Dec 2012 12:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244424 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 12:00:10 -0000 Author: pjd Date: Wed Dec 19 12:00:09 2012 New Revision: 244424 URL: http://svnweb.freebsd.org/changeset/base/244424 Log: The expand_name() function isn't called with the process lock held anymore, so we can safely use malloc(M_WAITOK) now. Pointed out by: kib Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Wed Dec 19 11:17:08 2012 (r244423) +++ head/sys/kern/kern_sig.c Wed Dec 19 12:00:09 2012 (r244424) @@ -3057,9 +3057,7 @@ expand_name(const char *comm, uid_t uid, hostname = NULL; format = corefilename; - name = malloc(MAXPATHLEN, M_TEMP, M_NOWAIT | M_ZERO); - if (name == NULL) - return (NULL); + name = malloc(MAXPATHLEN, M_TEMP, M_WAITOK | M_ZERO); indexpos = -1; (void)sbuf_new(&sb, name, MAXPATHLEN, SBUF_FIXEDLEN); for (i = 0; format[i]; i++) { @@ -3073,16 +3071,7 @@ expand_name(const char *comm, uid_t uid, case 'H': /* hostname */ if (hostname == NULL) { hostname = malloc(MAXHOSTNAMELEN, - M_TEMP, M_NOWAIT); - if (hostname == NULL) { - log(LOG_ERR, - "pid %ld (%s), uid (%lu): " - "unable to alloc memory " - "for corefile hostname\n", - (long)pid, comm, - (u_long)uid); - goto nomem; - } + M_TEMP, M_WAITOK); } getcredhostname(td->td_ucred, hostname, MAXHOSTNAMELEN); @@ -3119,7 +3108,6 @@ expand_name(const char *comm, uid_t uid, if (sbuf_error(&sb) != 0) { log(LOG_ERR, "pid %ld (%s), uid (%lu): corename is too " "long\n", (long)pid, comm, (u_long)uid); -nomem: sbuf_delete(&sb); free(name, M_TEMP); return (NULL);