From owner-svn-src-stable-10@freebsd.org Fri Jun 26 06:08:53 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C39198DD2D; Fri, 26 Jun 2015 06:08:53 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) 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 328401C50; Fri, 26 Jun 2015 06:08:53 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5Q68rRR001543; Fri, 26 Jun 2015 06:08:53 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5Q68rVj001542; Fri, 26 Jun 2015 06:08:53 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201506260608.t5Q68rVj001542@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 26 Jun 2015 06:08:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284867 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2015 06:08:53 -0000 Author: arybchik Date: Fri Jun 26 06:08:52 2015 New Revision: 284867 URL: https://svnweb.freebsd.org/changeset/base/284867 Log: MFC: r284747 sfxge: skip VPD info population if access is denied The patch allows to run on unprivileged PF (PFIOV) passed to a virtual machine. Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.c Fri Jun 26 04:14:05 2015 (r284866) +++ stable/10/sys/dev/sfxge/sfxge.c Fri Jun 26 06:08:52 2015 (r284867) @@ -902,8 +902,15 @@ sfxge_vpd_init(struct sfxge_softc *sc) efx_vpd_value_t value; int rc; - if ((rc = efx_vpd_size(sc->enp, &sc->vpd_size)) != 0) + if ((rc = efx_vpd_size(sc->enp, &sc->vpd_size)) != 0) { + /* + * Unpriviledged functions deny VPD access. + * Simply skip VPD in this case. + */ + if (rc == EACCES) + goto done; goto fail; + } sc->vpd_data = malloc(sc->vpd_size, M_SFXGE, M_WAITOK); if ((rc = efx_vpd_read(sc->enp, sc->vpd_data, sc->vpd_size)) != 0) goto fail2; @@ -932,6 +939,7 @@ sfxge_vpd_init(struct sfxge_softc *sc) for (keyword[1] = 'A'; keyword[1] <= 'Z'; keyword[1]++) sfxge_vpd_try_add(sc, vpd_list, EFX_VPD_RO, keyword); +done: return (0); fail2: