diff --git a/src/afs/SOLARIS/osi_vfsops.c b/src/afs/SOLARIS/osi_vfsops.c index dbc76ab78b..254c9acf8f 100644 --- a/src/afs/SOLARIS/osi_vfsops.c +++ b/src/afs/SOLARIS/osi_vfsops.c @@ -574,6 +574,19 @@ static struct modlinkage afs_modlinkage = { NULL }; +static void +reset_sysent(void) +{ + if (afs_sinited) { + sysent[SYS_setgroups].sy_callc = afs_orig_setgroups; + sysent[SYS_ioctl].sy_call = afs_orig_ioctl; +#if defined(AFS_SUN57_64BIT_ENV) + sysent32[SYS_setgroups].sy_callc = afs_orig_setgroups32; + sysent32[SYS_ioctl].sy_call = afs_orig_ioctl32; +#endif + } +} + /** This is the function that modload calls when loading the afs kernel * extensions. The solaris modload program searches for the _init * function in a module and calls it when modloading @@ -670,6 +683,11 @@ _init() osi_Init(); /* initialize global lock, etc */ code = mod_install(&afs_modlinkage); + if (code) { + /* we failed to load, so make sure we don't leave behind any + * references to our syscall handlers */ + reset_sysent(); + } return code; } @@ -689,14 +707,7 @@ _fini() if (afs_globalVFS) return EBUSY; - if (afs_sinited) { - sysent[SYS_setgroups].sy_callc = afs_orig_setgroups; - sysent[SYS_ioctl].sy_call = afs_orig_ioctl; -#if defined(AFS_SUN57_64BIT_ENV) - sysent32[SYS_setgroups].sy_callc = afs_orig_setgroups32; - sysent32[SYS_ioctl].sy_call = afs_orig_ioctl32; -#endif - } + reset_sysent(); code = mod_remove(&afs_modlinkage); return code; }