summaryrefslogtreecommitdiff
path: root/fs/cifs/fs_context.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2020-12-14 09:40:16 +0300
committerSteve French <stfrench@microsoft.com>2020-12-14 18:26:30 +0300
commitc741cba2cd1d145c71f928c329cac007e6f99e42 (patch)
tree59d8ed96bb5aabc937413d85774ea409ca384004 /fs/cifs/fs_context.c
parent427c4f004e173732ab0eb248e6ec89ef79524cd5 (diff)
downloadlinux-c741cba2cd1d145c71f928c329cac007e6f99e42.tar.xz
cifs: move cifs_cleanup_volume_info[_content] to fs_context.c
and rename it to smb3_cleanup_fs_context[_content] Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/fs_context.c')
-rw-r--r--fs/cifs/fs_context.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
index c41e87af77b6..4d8caf5b9519 100644
--- a/fs/cifs/fs_context.c
+++ b/fs/cifs/fs_context.c
@@ -290,7 +290,7 @@ do { \
if (ctx->field) { \
new_ctx->field = kstrdup(ctx->field, GFP_ATOMIC); \
if (new_ctx->field == NULL) { \
- cifs_cleanup_volume_info_contents(new_ctx); \
+ smb3_cleanup_fs_context_contents(new_ctx); \
return -ENOMEM; \
} \
} \
@@ -313,7 +313,7 @@ smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx
new_ctx->iocharset = NULL;
/*
- * Make sure to stay in sync with cifs_cleanup_volume_info_contents()
+ * Make sure to stay in sync with smb3_cleanup_fs_context_contents()
*/
DUP_CTX_STR(prepath);
DUP_CTX_STR(mount_options);
@@ -618,7 +618,7 @@ static void smb3_fs_context_free(struct fs_context *fc)
{
struct smb3_fs_context *ctx = smb3_fc2context(fc);
- cifs_cleanup_volume_info(ctx);
+ smb3_cleanup_fs_context(ctx);
}
static int smb3_reconfigure(struct fs_context *fc)
@@ -1244,3 +1244,42 @@ int smb3_init_fs_context(struct fs_context *fc)
fc->ops = &smb3_fs_context_ops;
return 0;
}
+
+void
+smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx)
+{
+ if (ctx == NULL)
+ return;
+
+ /*
+ * Make sure this stays in sync with smb3_fs_context_dup()
+ */
+ kfree(ctx->mount_options);
+ ctx->mount_options = NULL;
+ kfree(ctx->username);
+ ctx->username = NULL;
+ kfree_sensitive(ctx->password);
+ ctx->password = NULL;
+ kfree(ctx->UNC);
+ ctx->UNC = NULL;
+ kfree(ctx->domainname);
+ ctx->domainname = NULL;
+ kfree(ctx->nodename);
+ ctx->nodename = NULL;
+ kfree(ctx->iocharset);
+ ctx->iocharset = NULL;
+ kfree(ctx->prepath);
+ ctx->prepath = NULL;
+
+ unload_nls(ctx->local_nls);
+ ctx->local_nls = NULL;
+}
+
+void
+smb3_cleanup_fs_context(struct smb3_fs_context *ctx)
+{
+ if (!ctx)
+ return;
+ smb3_cleanup_fs_context_contents(ctx);
+ kfree(ctx);
+}