diff options
author | Seth Forshee <seth.forshee@canonical.com> | 2018-07-13 12:49:02 -0500 |
---|---|---|
committer | Seth Forshee <seth.forshee@canonical.com> | 2018-07-13 16:32:52 -0500 |
commit | dee3c9cdeceeecc1f3491cf29992b9fb8b082b37 (patch) | |
tree | a6080193eaa369c5fa33131af527dd2d238168db | |
parent | 9669c7b24aa97c4ef10d6c65d7ecc305fbd5b9ca (diff) | |
download | linux-shiftfs-fscontext.tar.gz |
shiftfs: Handle multiple frees of single fs_contextshiftfs-fscontext
The fs_context free callback can be called multiple times for the
same fs_context data, once during fsmount() and then again when
the filesystem fd is closed. Deal with this by checking that
fc->fs_private is not null before freeing private data and setting
it to NULL when private data is freed.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
-rw-r--r-- | fs/shiftfs.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/shiftfs.c b/fs/shiftfs.c index 2885e3f73fbda3..903f6fe64c00d1 100644 --- a/fs/shiftfs.c +++ b/fs/shiftfs.c @@ -730,6 +730,10 @@ static void shiftfs_fs_context_free(struct fs_context *fc) { struct shiftfs_fs_context *ctx = fc->fs_private; + if (!ctx) + return; + + fc->fs_private = NULL; if (ctx->src_path) { path_put(ctx->src_path); kfree(ctx->src_path); |