From patchwork Fri Sep 7 12:25:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10592133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 73DDF5A4 for ; Fri, 7 Sep 2018 12:25:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 617AA2B162 for ; Fri, 7 Sep 2018 12:25:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52B422B178; Fri, 7 Sep 2018 12:25:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0CF82B162 for ; Fri, 7 Sep 2018 12:25:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728439AbeIGRG1 (ORCPT ); Fri, 7 Sep 2018 13:06:27 -0400 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 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w87COKjh011713; Fri, 7 Sep 2018 12:25:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=N+ujIbK9Yemnj9t+xeKEDQTVGoiuw4jzhHBHifwJo6o=; b=LieHqVgN56cByqrHhkSJ8FY3nLMJQ/bz/QIlM7xId4RZ4DMoQrAtM+iL2xpQgNEnuEqK HQ+hBrTJnTAUPEn78xwW7QJDlnpg1WQtEc9ufc9wHKGJrc2erl48QtiiKk+jqLSkwuf3 sgIn8HIfT6UvkIy560rd1LDgJ65D/ylFXjdCgY4O3SZ3EZ4gSUDBo9FfRFe2ruUJ2wUm 8pD12a9Z6L/9BrCx7kIPjIvXRaNxV8nTsvWTAiCidGDLMG60ndNDGP2W87MmCDHMpi74 H1FAkOOM09QQeSHMPmvodxya4NfXzxAI+/pdhVD9Vr9azpiFLHm+BEAhOR4blE0FIF8w bQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2m7jqq2br1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 07 Sep 2018 12:25:42 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w87CPf6J027941 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 7 Sep 2018 12:25:41 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w87CPesf026108; Fri, 7 Sep 2018 12:25:40 GMT Received: from kili.mountain (/197.232.248.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 07 Sep 2018 05:25:40 -0700 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-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9008 signatures=668708 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809070126 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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)