From d17abdf7566566fc402c31899b353044a7ff3cf4 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Tue, 10 Nov 2020 08:59:26 +1000 Subject: cifs: add an smb3_fs_context to cifs_sb and populate it during mount in cifs_smb3_do_mount() Signed-off-by: Ronnie Sahlberg Reviewed-by: Shyam Prasad N Signed-off-by: Steve French --- fs/cifs/connect.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'fs/cifs/connect.c') diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index ec3c952b90f2..5146c4645537 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2799,6 +2799,9 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, void cifs_cleanup_volume_info_contents(struct smb3_fs_context *ctx) { + if (ctx == NULL) + return; + /* * Make sure this stays in sync with smb3_fs_context_dup() */ @@ -2818,6 +2821,9 @@ cifs_cleanup_volume_info_contents(struct smb3_fs_context *ctx) ctx->iocharset = NULL; kfree(ctx->prepath); ctx->prepath = NULL; + + unload_nls(ctx->local_nls); + ctx->local_nls = NULL; } void @@ -3739,9 +3745,11 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses, static void delayed_free(struct rcu_head *p) { - struct cifs_sb_info *sbi = container_of(p, struct cifs_sb_info, rcu); - unload_nls(sbi->local_nls); - kfree(sbi); + struct cifs_sb_info *cifs_sb = container_of(p, struct cifs_sb_info, rcu); + + unload_nls(cifs_sb->local_nls); + cifs_cleanup_volume_info(cifs_sb->ctx); + kfree(cifs_sb); } void -- cgit v1.2.3