Project

General

Profile

Actions

Bug #4650

closed

nfssrv module is left half-initialized if mod_install(9f) fails

Added by Marcel Telka over 8 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
nfs - NFS server and client
Start date:
2014-02-28
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

The _init() function of the nfssrv module will perform the following initialization, even the call to mod_install() failed:

131    /*
132     * Initialise some placeholders for nfssys() calls. These have
133     * to be declared by the nfs module, since that handles nfssys()
134     * calls - also used by NFS clients - but are provided by this
135     * nfssrv module. These also then serve as confirmation to the
136     * relevant code in nfs that nfssrv has been loaded, as they're
137     * initially NULL.
138     */
139    nfs_srv_quiesce_func = nfs_srv_quiesce_all;
140    nfs_srv_dss_func = rfs4_dss_setpaths;
141
142    /* setup DSS paths here; must be done before initial server startup */
143    rfs4_dss_paths = rfs4_dss_oldpaths = NULL;
144
145    /* initialize the copy reduction caches */
146
147    nfs_xuio_cache = kmem_cache_create("nfs_xuio_cache",
148        sizeof (nfs_xuio_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
149
150    return (status);
151}

This might cause memory leak and/or panic.

To fix this issue we should add return (status) after the nfs_srvfini() call here:

122    status = mod_install((struct modlinkage *)&modlinkage);
123    if (status != 0) {
124        /*
125         * Could not load module, cleanup previous
126         * initialization work.
127         */
128        nfs_srvfini();
129    }
Actions

Also available in: Atom PDF