diff options
author | Andrew Rybchenko <arybchik@FreeBSD.org> | 2015-06-24 06:25:20 +0000 |
---|---|---|
committer | Andrew Rybchenko <arybchik@FreeBSD.org> | 2015-06-24 06:25:20 +0000 |
commit | 29033246a84d7fc206bcc3c48239650b7f77a46b (patch) | |
tree | fbe941f968a01c23bb8b64511036f6fbc51c2dd3 /sys/dev/sfxge/sfxge.c | |
parent | 5efed58bdd6b90d48c8e376fd0ff7ea406fb7905 (diff) | |
download | src-29033246a84d7fc206bcc3c48239650b7f77a46b.tar.gz src-29033246a84d7fc206bcc3c48239650b7f77a46b.zip |
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
Notes
Notes:
svn path=/head/; revision=284747
Diffstat (limited to 'sys/dev/sfxge/sfxge.c')
-rw-r--r-- | sys/dev/sfxge/sfxge.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/dev/sfxge/sfxge.c b/sys/dev/sfxge/sfxge.c index f484b743b310..3ee908b90b8d 100644 --- a/sys/dev/sfxge/sfxge.c +++ b/sys/dev/sfxge/sfxge.c @@ -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: |