From d08163d59e935fbf5bb2ccdbe31808546616b20d Mon Sep 17 00:00:00 2001 From: arybchik Date: Fri, 26 Jun 2015 06:08:52 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.freebsd.org/base/stable/10@284867 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/sfxge/sfxge.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/dev/sfxge/sfxge.c b/sys/dev/sfxge/sfxge.c index 5e5d3dc2b..46b138f46 100644 --- a/sys/dev/sfxge/sfxge.c +++ b/sys/dev/sfxge/sfxge.c @@ -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: -- 2.45.0