--- x/fs/fs_context.c +++ y/fs/fs_context.c @@ -282,6 +282,8 @@ static struct fs_context *alloc_fs_conte struct fs_context *fc; int ret = -ENOMEM; + if (current->flags & PF_EXITING) + return ERR_PTR(-ENOMEM); fc = kzalloc(sizeof(struct fs_context), GFP_KERNEL_ACCOUNT); if (!fc) return ERR_PTR(-ENOMEM);