Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp396106ybl; Tue, 13 Aug 2019 23:14:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzh3ZweedCE/7K1ZW+fNjZDlGOfiVvCl2APkW36sSX8wi5VCy7R8K0O5vnRM2olL5bHz9Uz X-Received: by 2002:a17:90a:b393:: with SMTP id e19mr5695848pjr.118.1565763295261; Tue, 13 Aug 2019 23:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565763295; cv=none; d=google.com; s=arc-20160816; b=hzZJkqhnbdW5+IHJu3WjYI/9Yhp9DAMIX2dGn4nuLZ3rv1eT6PAqfRPIcV4f4sjKn8 VwI72EiWyntiN6EuImCTBImvOQtw/ugT1/s3hOzbetGW9utaDcV0B/J4o6lp/Ui1IOoT XvVQau7aAEMC0OnSCnzz+wy8Kgp4p0BEsYD8k29S1HkW+LKfrU7PjJRv64RmzhG16U2R q+zloQrbiLXDmQeryNSz453SB5gLRwZchNxv+TlV8VTrC6DkWRF2sWlj2XlDTNxXfnY2 tCegpnjbfCR4xcZ5U4giKA+03W64Qdre3dhLA1CV4tgukCLh/oaSWm78Ucp/aWCpaUeU Dm+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=zH0H/Am6rFEX7Tq6/Cx8jitdW00s+oXxcueR2OogNUY=; b=p9pS/qcmeK2EyWkmuWbmKdnqpCdmaLloceU4wEc38wUCQ1Bcmm3y0tIDEC4q3rteg/ O0xzYRhgK4zcv5Rd/T/Q0EE1oLDxHsf5EYdC6b+1y3KGBy4YkzO/eFlQUTHXnKgSXFgv X9YWhqAiQE7xwXG7S8W597tv3bnGNbWmnWpN2VGEryiRkcSSR/d/8dNVlnB6i5q8OKwv jkb1FV370kF71lDpcZ4kbpsIUGzRCiCAhjMyEVAjHI/96/itydjJ6KWuOXDS0v6KTSPD UvwXPJeMFttrT7lL/WpmbHIdFAnvJ/FVk9h99qAkvjXxolP9yLPwz7OF8tUVZHzH1uos kyeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ptEpUAIa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si2311921pjn.71.2019.08.13.23.14.39; Tue, 13 Aug 2019 23:14:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ptEpUAIa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727414AbfHNGMy (ORCPT + 99 others); Wed, 14 Aug 2019 02:12:54 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:37766 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbfHNGMy (ORCPT ); Wed, 14 Aug 2019 02:12:54 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190814061247euoutp02735e3acaa4a4a8f7828dc2f8a3d00f7c~6tU4xbF-X3018130181euoutp02F for ; Wed, 14 Aug 2019 06:12:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190814061247euoutp02735e3acaa4a4a8f7828dc2f8a3d00f7c~6tU4xbF-X3018130181euoutp02F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1565763167; bh=zH0H/Am6rFEX7Tq6/Cx8jitdW00s+oXxcueR2OogNUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ptEpUAIaNgvE1i5zMWM3q2N7x5ytt0Wtv8g9Y2t/LTULSrS0f/2k1Y1MSYnlvEFlM Y8yIUjA6BtVFyz/8fSkC5phA+CgSRWzlomq3M+3FjKpMGx6XZ4pm79et6aHw48PWk1 igh8OVS+SSlOr8r1oZy2vLHKLriAeMoYvGNxSmps= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190814061247eucas1p273e1ee2d5ddfd66456a2e5b56a5cf0f7~6tU4AjTkD0131201312eucas1p22; Wed, 14 Aug 2019 06:12:47 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id E3.EC.04469.E56A35D5; Wed, 14 Aug 2019 07:12:46 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190814061246eucas1p128cae99a14f27bc79fa2aa72084a0413~6tU3HJw2A1469514695eucas1p1a; Wed, 14 Aug 2019 06:12:46 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190814061245eusmtrp2a1aaa016b1a42773ea640a87ed942faa~6tU23iRIY3153431534eusmtrp2L; Wed, 14 Aug 2019 06:12:45 +0000 (GMT) X-AuditID: cbfec7f2-54fff70000001175-af-5d53a65ef895 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C4.70.04166.D56A35D5; Wed, 14 Aug 2019 07:12:45 +0100 (BST) Received: from AMDC2765.DIGITAL.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190814061245eusmtip1d471fa5f1d7b228d17d85b301acb80cd~6tU2VXBym2287722877eusmtip1W; Wed, 14 Aug 2019 06:12:45 +0000 (GMT) From: Marek Szyprowski To: linux-kernel@vger.kernel.org Cc: Marek Szyprowski , Matthew Garrett , Steven Rostedt , James Morris , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , linux-security-module@vger.kernel.org, linux-api@vger.kernel.org, Matthew Garrett Subject: [PATCH] tracefs: Fix NULL pointer dereference when no lockdown is used Date: Wed, 14 Aug 2019 08:12:37 +0200 Message-Id: <20190814061237.17406-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <3028ed35-3b6d-459f-f3c8-103c5636fe95@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42LZduzned24ZcGxBm8mGlhsnLGe1WLd+sVM FufPb2C32Py9g83i8q45bBYfeh6xWaw9cpfd4tULLYt/G96wWOzreMDkwOXRsu8Wu8eCTaUe m1Z1snn0fE/26NuyitHj8ya5ALYoLpuU1JzMstQifbsErow9D26zFMznqLjzp5upgfErWxcj B4eEgIlE93rnLkYuDiGBFYwS//Z/YYFwvjBKPLv7iBXC+cwo0b67j72LkROs40nnVEaIxHJG iQ9r/rLDtXxu+ccGUsUmYCjR9bYLzBYRUJDY3PsMbBSzwEcmiYuHP4AlhAUCJbb/OM4CYrMI qEpMuH8RzOYVsJVY276NDWKdvMTqDQeYQWxOAXuJA1ebwA6UEGhnl/i9ZgIzRJGLxJlDn6Bs YYlXx7dA3Soj8X/nfCaIhmZGiYfn1rJDOD2MEpebZjBCVFlLHD5+kRUUHswCmhLrd+lDhB0l Xh9YyQIJJj6JG28FQcLMQOakbdOZIcK8Eh1tQhDVahKzjq+DW3vwwiWoczwkph87ygwJoUmM Es1HGpkmMMrPQli2gJFxFaN4amlxbnpqsWFearlecWJucWleul5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ZT 5syb3yvC9CUoVmCX8AwF+7T2D5drCzvXvNz1jqF7fktyCrf4xHrNxm0t17Kc+RjqPtXxKu/r Nlmyqy1f+LYUw4q5CelG29hFFymxFGckGmoxFxUnAgAZkavBgQIAAA== X-CMS-MailID: 20190814061246eucas1p128cae99a14f27bc79fa2aa72084a0413 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190814061246eucas1p128cae99a14f27bc79fa2aa72084a0413 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190814061246eucas1p128cae99a14f27bc79fa2aa72084a0413 References: <3028ed35-3b6d-459f-f3c8-103c5636fe95@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 757ff7244358 ("tracefs: Restrict tracefs when the kernel is locked down") added infrastructure for restricting tracefs access when lockdown is enabled. It however broke tracefs operation when no lockdown is used. Fix this issue by adding missing check for a NULL ->open() callback. Fixes: 757ff7244358 ("tracefs: Restrict tracefs when the kernel is locked down") Reported-by: Krzysztof Kozlowski Signed-off-by: Marek Szyprowski --- fs/tracefs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index 12a325fb4cbd..8efff7603032 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -43,7 +43,7 @@ static int default_open_file(struct inode *inode, struct file *filp) return ret; real_fops = dentry->d_fsdata; - return real_fops->open(inode, filp); + return real_fops->open ? real_fops->open(inode, filp) : 0; } static ssize_t default_read_file(struct file *file, char __user *buf, -- 2.17.1