Date: Wed, 24 Jun 2015 06:25:20 +0000 (UTC) From: Andrew Rybchenko <arybchik@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284747 - head/sys/dev/sfxge Message-ID: <201506240625.t5O6PKx9044027@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: arybchik Date: Wed Jun 24 06:25:20 2015 New Revision: 284747 URL: https://svnweb.freebsd.org/changeset/base/284747 Log: 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. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D2891 Modified: head/sys/dev/sfxge/sfxge.c Modified: head/sys/dev/sfxge/sfxge.c ============================================================================== --- head/sys/dev/sfxge/sfxge.c Wed Jun 24 06:01:29 2015 (r284746) +++ head/sys/dev/sfxge/sfxge.c Wed Jun 24 06:25:20 2015 (r284747) @@ -905,8 +905,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; @@ -935,6 +942,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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506240625.t5O6PKx9044027>