From owner-svn-src-all@FreeBSD.ORG Fri Nov 7 19:34:11 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4905CCA3; Fri, 7 Nov 2014 19:34:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36140167; Fri, 7 Nov 2014 19:34:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA7JYB87010991; Fri, 7 Nov 2014 19:34:11 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA7JYBQU010990; Fri, 7 Nov 2014 19:34:11 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201411071934.sA7JYBQU010990@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Fri, 7 Nov 2014 19:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r274249 - head/sys/dev/ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Nov 2014 19:34:11 -0000 Author: zbb Date: Fri Nov 7 19:34:10 2014 New Revision: 274249 URL: https://svnweb.freebsd.org/changeset/base/274249 Log: Avoid panic in ofwbus caused by not released resource list entry After resource allocation and release, resource list entry stays non-NULL. This causes panic in ofwbus_alloc_resource() on subsequent resource allocation. Clean appropriate list entry on release to avoid this. Obtained from: Semihalf Reviewed by: ian Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/ofw/ofwbus.c Modified: head/sys/dev/ofw/ofwbus.c ============================================================================== --- head/sys/dev/ofw/ofwbus.c Fri Nov 7 19:32:10 2014 (r274248) +++ head/sys/dev/ofw/ofwbus.c Fri Nov 7 19:34:10 2014 (r274249) @@ -399,11 +399,17 @@ ofwbus_adjust_resource(device_t bus, dev } static int -ofwbus_release_resource(device_t bus __unused, device_t child, int type, +ofwbus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { + struct resource_list_entry *rle; int error; + /* Clean resource list entry */ + rle = resource_list_find(BUS_GET_RESOURCE_LIST(bus, child), type, rid); + if (rle != NULL) + rle->res = NULL; + if ((rman_get_flags(r) & RF_ACTIVE) != 0) { error = bus_deactivate_resource(child, type, rid, r); if (error)