From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp2120.oracle.com ([141.146.126.78]:53344 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727568AbeIGRG1 (ORCPT ); Fri, 7 Sep 2018 13:06:27 -0400 Date: Fri, 7 Sep 2018 15:25:34 +0300 From: Dan Carpenter To: Alexander Viro , David Howells Cc: linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] vfs: namespace: error pointer dereference in do_remount() Message-ID: <20180907122534.ojogke2alt3ldbom@kili.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: We need to check if vfs_new_fs_context() returns an error pointer. Fixes: fd0002870b45 ("vfs: Implement a filesystem superblock creation/configuration context") Signed-off-by: Dan Carpenter diff --git a/fs/namespace.c b/fs/namespace.c index a240e20093e0..841517520c08 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2384,6 +2384,8 @@ static int do_remount(struct path *path, int ms_flags, int sb_flags, fc = vfs_new_fs_context(path->dentry->d_sb->s_type, path->dentry, sb_flags, MS_RMT_MASK, FS_CONTEXT_FOR_RECONFIGURE); + if (IS_ERR(fc)) + return PTR_ERR(fc); err = parse_monolithic_mount_data(fc, data, data_size); if (err < 0)