RPCSEC_GSS: Fix an Oopsable condition when creating/destroying pipefs objects
If an error condition occurs on rpc_pipefs creation, or the user mounts rpc_pipefs and then unmounts it, then the dentries in struct gss_auth need to be reset to NULL so that a second call to gss_pipes_dentries_destroy doesn't try to free them again. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
e726340ac9
commit
6b2fddd3e7
1 changed files with 20 additions and 12 deletions
|
@ -796,10 +796,14 @@ static void gss_pipes_dentries_destroy(struct rpc_auth *auth)
|
||||||
struct gss_auth *gss_auth;
|
struct gss_auth *gss_auth;
|
||||||
|
|
||||||
gss_auth = container_of(auth, struct gss_auth, rpc_auth);
|
gss_auth = container_of(auth, struct gss_auth, rpc_auth);
|
||||||
if (gss_auth->pipe[0]->dentry)
|
if (gss_auth->pipe[0]->dentry) {
|
||||||
rpc_unlink(gss_auth->pipe[0]->dentry);
|
rpc_unlink(gss_auth->pipe[0]->dentry);
|
||||||
if (gss_auth->pipe[1]->dentry)
|
gss_auth->pipe[0]->dentry = NULL;
|
||||||
|
}
|
||||||
|
if (gss_auth->pipe[1]->dentry) {
|
||||||
rpc_unlink(gss_auth->pipe[1]->dentry);
|
rpc_unlink(gss_auth->pipe[1]->dentry);
|
||||||
|
gss_auth->pipe[1]->dentry = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gss_pipes_dentries_create(struct rpc_auth *auth)
|
static int gss_pipes_dentries_create(struct rpc_auth *auth)
|
||||||
|
@ -807,26 +811,30 @@ static int gss_pipes_dentries_create(struct rpc_auth *auth)
|
||||||
int err;
|
int err;
|
||||||
struct gss_auth *gss_auth;
|
struct gss_auth *gss_auth;
|
||||||
struct rpc_clnt *clnt;
|
struct rpc_clnt *clnt;
|
||||||
|
struct dentry *dentry;
|
||||||
|
|
||||||
gss_auth = container_of(auth, struct gss_auth, rpc_auth);
|
gss_auth = container_of(auth, struct gss_auth, rpc_auth);
|
||||||
clnt = gss_auth->client;
|
clnt = gss_auth->client;
|
||||||
|
|
||||||
gss_auth->pipe[1]->dentry = rpc_mkpipe_dentry(clnt->cl_dentry,
|
dentry = rpc_mkpipe_dentry(clnt->cl_dentry, "gssd",
|
||||||
"gssd",
|
clnt, gss_auth->pipe[1]);
|
||||||
clnt, gss_auth->pipe[1]);
|
if (IS_ERR(dentry)) {
|
||||||
if (IS_ERR(gss_auth->pipe[1]->dentry))
|
err = PTR_ERR(dentry);
|
||||||
return PTR_ERR(gss_auth->pipe[1]->dentry);
|
goto err;
|
||||||
gss_auth->pipe[0]->dentry = rpc_mkpipe_dentry(clnt->cl_dentry,
|
}
|
||||||
gss_auth->mech->gm_name,
|
gss_auth->pipe[1]->dentry = dentry;
|
||||||
clnt, gss_auth->pipe[0]);
|
dentry = rpc_mkpipe_dentry(clnt->cl_dentry, gss_auth->mech->gm_name,
|
||||||
if (IS_ERR(gss_auth->pipe[0]->dentry)) {
|
clnt, gss_auth->pipe[0]);
|
||||||
err = PTR_ERR(gss_auth->pipe[0]->dentry);
|
if (IS_ERR(dentry)) {
|
||||||
|
err = PTR_ERR(dentry);
|
||||||
goto err_unlink_pipe_1;
|
goto err_unlink_pipe_1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_unlink_pipe_1:
|
err_unlink_pipe_1:
|
||||||
rpc_unlink(gss_auth->pipe[1]->dentry);
|
rpc_unlink(gss_auth->pipe[1]->dentry);
|
||||||
|
gss_auth->pipe[1]->dentry = NULL;
|
||||||
|
err:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue