Project

General

Profile

Bug #4650

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

Added by Marcel Telka about 6 years ago. Updated about 6 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

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    }

History

#1

Updated by Marcel Telka about 6 years ago

  • Status changed from New to In Progress
#2

Updated by Marcel Telka about 6 years ago

  • Status changed from In Progress to Pending RTI
#3

Updated by Rich Lowe about 6 years ago

  • Status changed from Pending RTI to Resolved
#4

Updated by Electric Monk about 6 years ago

git commit 41bec5e379cee655ed15b8f2cf031e24aefb9d36

Author: Marcel Telka <marcel.telka@nexenta.com>

4650 nfssrv module is left half-initialized if mod_install(9f) fails
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

Also available in: Atom PDF