From patchwork Mon May 28 02:08:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 10429649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 37CF760327 for ; Mon, 28 May 2018 02:01:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E5FA28B74 for ; Mon, 28 May 2018 02:01:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12C5128B7A; Mon, 28 May 2018 02:01:56 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 50F9528B74 for ; Mon, 28 May 2018 02:01:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752940AbeE1CBw (ORCPT ); Sun, 27 May 2018 22:01:52 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8156 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752936AbeE1CBv (ORCPT ); Sun, 27 May 2018 22:01:51 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 50B7469AE45A0; Mon, 28 May 2018 10:01:37 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Mon, 28 May 2018 10:01:33 +0800 From: Wei Yongjun To: James Morris , "Serge E. Hallyn" , Dmitry Kasatkin , Mimi Zohar , Matthew Garrett , Jeff Layton , Thiago Jung Bauermann CC: Wei Yongjun , , Subject: [PATCH -next] integrity: fix the error return code in integrity_load_keys() Date: Mon, 28 May 2018 02:08:36 +0000 Message-ID: <1527473316-35602-1-git-send-email-weiyongjun1@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The error return code PTR_ERR(integrity_dir) is always 0 since integrity_dir is set to NULL in this error handling case. Fixes: 0c343af8065b ("integrity: Add an integrity directory in securityfs") Signed-off-by: Wei Yongjun Acked-by: Serge Hallyn --- security/integrity/iint.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/security/integrity/iint.c b/security/integrity/iint.c index 149faa8..2dfc9e8 100644 --- a/security/integrity/iint.c +++ b/security/integrity/iint.c @@ -217,12 +217,15 @@ void __init integrity_load_keys(void) static int __init integrity_fs_init(void) { + int ret; + integrity_dir = securityfs_create_dir("integrity", NULL); if (IS_ERR(integrity_dir)) { pr_err("Unable to create integrity sysfs dir: %ld\n", PTR_ERR(integrity_dir)); + ret = PTR_ERR(integrity_dir); integrity_dir = NULL; - return PTR_ERR(integrity_dir); + return ret; } return 0;