From patchwork Sat Sep 10 07:43:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9326351 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 742F26077F for ; Mon, 12 Sep 2016 12:14:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B6EA28D67 for ; Mon, 12 Sep 2016 12:14:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E9EC28D69; Mon, 12 Sep 2016 12:14:54 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from emsm-gh1-uea11.nsa.gov (smtp.nsa.gov [8.44.101.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 90B0C28D68 for ; Mon, 12 Sep 2016 12:14:52 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.30,322,1470700800"; d="scan'208";a="19156151" IronPort-PHdr: =?us-ascii?q?9a23=3A74KUMxbLTaiABIfFEnHkw6D/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZosy4bnLW6fgltlLVR4KTs6sC0LuP9f6wEjBRqdbZ6TZZIcQKD0dEwe?= =?us-ascii?q?wt3CUYSPafDkP6KPO4JwcbJ+9lEGFfwnegLEJOE9z/bVCB6le77DoVBwmtfVEt?= =?us-ascii?q?fre9JIfegoyN2vyo/NWLOkMT1WP7P+M5cET+7V2I8JJH2c06cud54yCKi0MAQ/?= =?us-ascii?q?5Ry2JsKADbtDfHzeD0wqRe9T9Nsekq7c9KXPayVa05SbtFEGZuaDhtt4XD/CPO?= =?us-ascii?q?RgqX53YaTn5e0l8RW1CEvyzgWt/Nlgey9q8kgGjJdfHxGIg9RDDqyqBsUhKg3D?= =?us-ascii?q?8OKjoR6GjKjol1i6VBrVSqoBkph8bvfIyNNPd4NpjYdNceSHsJCt1dTARdE4i8?= =?us-ascii?q?aM0JFONHMuFG+c21ikEPplOGDBOtH6u7xydBnH7t9bUzyeU6CQXP1wFmGMgB5j?= =?us-ascii?q?CcjtzwObxadOev1qjThWHBZvZbwnH5ro3PaAogutmLR7t7dceXwk4qQUeNxG6d?= =?us-ascii?q?s4Podx7TnsQEt2yK6aAoAfmikWEqgwF4pjy+wIEnjYyfwsoqy1TA9Cx8iLwyL9?= =?us-ascii?q?CiVFUzNcGlFJ9RviTcPM1sRckvWX1zkCc81rAC/5W8eX5Z5o4gwkvgZv3PQo+O?= =?us-ascii?q?7RD+Uq7FPjp5lXAjfLGXiBO78Ezmwer5AJrnmG1WpzZIx4Gf/ksG0Abev43eE6?= =?us-ascii?q?Nw?= X-IPAS-Result: =?us-ascii?q?A2HgAwAgm9ZX/wHyM5BeGgEBAQECAQEBAQgBAQEBFgEBAQM?= =?us-ascii?q?BAQEJAQEBgw4BAQEBAYFxrHyNSiOHO0wBAQEBAQEBAQIBAlsngjIEARUBBAU5E?= =?us-ascii?q?FUCK0MBBAIMAQIVEwYBDQ4SCwECAQIJAgUQAgghCAgDAR8OAwEFAQsXAQcLBRg?= =?us-ascii?q?EAYgNAQMXA6Y+gTI+MopVAQGCUIJeBYNZChknDVOCSwEBCAEBAQEbAgYQhBWIF?= =?us-ascii?q?AGCWREBhXgBBJljj0wCiVElhWgCSI5GMYERVIJlDQ0OgU5whFVfgUABAQE?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP; 12 Sep 2016 12:14:48 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u8CCDpjL021847; Mon, 12 Sep 2016 08:14:00 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u8A7i3s7128486 for ; Sat, 10 Sep 2016 03:44:03 -0400 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u8A7i2Pk010301; Sat, 10 Sep 2016 03:44:02 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1DKAgA1udNXekTcVdFeGwEBAQMBAQGDLQEBAQEBgXGseolChBKGHYFETAECAQEBAQECEwEBCQsMCBlwEgGEEAESAQIVGQEbHQEDEhAKVBEBBQEiARIiiA0BAxcDpmmBMj4yilUBAYJQgl4Fg2wKGScNU4JLAQEBAQEFAQEBAQEaAgYQhBWIEwGIYgWZY49MAolRhg0CSI5GMYERgzkNDQ6BTnCDb4N6AQEB X-IPAS-Result: A1DKAgA1udNXekTcVdFeGwEBAQMBAQGDLQEBAQEBgXGseolChBKGHYFETAECAQEBAQECEwEBCQsMCBlwEgGEEAESAQIVGQEbHQEDEhAKVBEBBQEiARIiiA0BAxcDpmmBMj4yilUBAYJQgl4Fg2wKGScNU4JLAQEBAQEFAQEBAQEaAgYQhBWIEwGIYgWZY49MAolRhg0CSI5GMYERgzkNDQ6BTnCDb4N6AQEB X-IronPort-AV: E=Sophos;i="5.30,309,1470715200"; d="scan'208";a="5696842" Received: from emsm-gh1-uea11.corp.nsa.gov (HELO emsm-gh1-uea11.nsa.gov) ([10.208.41.37]) by goalie.tycho.ncsc.mil with ESMTP; 10 Sep 2016 03:44:00 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3A7WfqHhBAaFsD1+RAfBC6UyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSPjyp8bcNUDSrc9gkEXOFd2CrakV0qyI7uu5AD1Ioc7Y9itTKNoUD15NoP?= =?us-ascii?q?5VtjRoONSCB0z/IayiRA0BN+MGamVY+WqmO1NeAsf0ag6aiHSz6TkPBke3blIt?= =?us-ascii?q?dazLE4Lfx/66y/q1s8WKJV4Z3XzjPPgrdUT+7V2I8JJH2c06cud54yCKi0MAQ/?= =?us-ascii?q?5Ry2JsKADbtDfHzeD0wqRe9T9Nsekq7c9KXPayVa05SbtFEGZuaDhtt4XD/CPO?= =?us-ascii?q?RgqX53YaTn5e0l8RW1CEv1nGWcLJuzb+/s963zOXdZnuRK0wcSyr8qMuTRjvki?= =?us-ascii?q?pBPDk8piWfsdB9lKJWplqaohV7x4PFKNWOOOFWYrLWfdRcQ3FIGMlWSXoFSq6m?= =?us-ascii?q?boBHN+MbPP0Q+4TlrkEPtjOmDBOtH/vrwzRFwHjs0vt+m8YoFAzdlCknBcgPqz?= =?us-ascii?q?yArtzwObxUVaawy7PSzC7raOlf0jPwroPPd0Zl6bu3UKh/fIL8jwEPHgfBn1Pa?= =?us-ascii?q?4dj+Mima28wNumyf/uwmXuWq3SpvlAB1pjmmw48WjYPEnJ4OggTb9CF9wY8wY9?= =?us-ascii?q?b+UklxbMS4C7NRsT2XM819RcZ0EE9yvyNv9bAH8a+8eicI1ZJvkwHSau2FNYyL?= =?us-ascii?q?yh3mXeeVZzx/gSQ2K/qEmx+u/B34maXHXc6u3QMP93Idnw=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0GFAwBdudNXekTcVdFeGwEBAQMBAQEXA?= =?us-ascii?q?QEEAQGDDgEBAQEBgXGseolChBKGHYFETAEBAQEBAQEBAgECEAEBCQsMCBkvQRI?= =?us-ascii?q?BgV4EARUBBAU5EFUCK0MBEgECFRkBGx0BAxIQClQRAQUBIgESIogNAQMXA6Zpg?= =?us-ascii?q?TI+MopVAQGCUIJeBYNsChknDVOCSwEBAQEBBQEBAQEBGgIGEIQViBMBiGIFmWO?= =?us-ascii?q?PTAKJUYYNAkiORjGBEYM5DQ0OgU5wg2+COoFAAQEB?= X-IPAS-Result: =?us-ascii?q?A0GFAwBdudNXekTcVdFeGwEBAQMBAQEXAQEEAQGDDgEBAQE?= =?us-ascii?q?BgXGseolChBKGHYFETAEBAQEBAQEBAgECEAEBCQsMCBkvQRIBgV4EARUBBAU5E?= =?us-ascii?q?FUCK0MBEgECFRkBGx0BAxIQClQRAQUBIgESIogNAQMXA6ZpgTI+MopVAQGCUIJ?= =?us-ascii?q?eBYNsChknDVOCSwEBAQEBBQEBAQEBGgIGEIQViBMBiGIFmWOPTAKJUYYNAkiOR?= =?us-ascii?q?jGBEYM5DQ0OgU5wg2+COoFAAQEB?= X-IronPort-AV: E=Sophos;i="5.30,309,1470700800"; d="scan'208";a="19140841" Received: from mail-pa0-f68.google.com ([209.85.220.68]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 10 Sep 2016 07:43:59 +0000 Received: by mail-pa0-f68.google.com with SMTP id ez1so4888093pab.3; Sat, 10 Sep 2016 00:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pG8QYjBSmqPpFpeA9xpdiRSMHx96d6VfN4bKiJBX9g8=; b=dA6OZH9BcxzhW3rorfTzxHS1PTNsjYiHEMe3WoEKHKefmJ+ur3QWOHbNX0/JgpoAhC 8Cm8CIux71geHsSU2wCu6td3dc9h6u/BPM0uEWDC+LqbF68CCA9OzumFF3iuua82395P n6FJMcZ/MV43nq1sMvAYq+hd5fUAJ6wpFV3HAowOeIsY0m7/Z4VNda77n/TLkZ2O30Zs 6F5YHj8gNobAvH5JE+d2ZLjxoZdMA/m+3szcSWtaT38oS3o/l0gINgQtK6PX0tSrVKXB IG7YRzcQMU20VzsX2Yuxzi+zl1CwuN+MdWt4EUqqNLVAAZWmi6UGdMjw1bB7AHjndQtp yqRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pG8QYjBSmqPpFpeA9xpdiRSMHx96d6VfN4bKiJBX9g8=; b=LICuZFKuVBYCXAKRPTbkd0pNjL6MwtKZEIYVLcAefVPO629ORzeeNKwA0EfL3ymtor WNhCzEfIFF/WVedvB2wLv3iWJ8aiim7qVUON+Rs5NH5TLstZ9FagzOrdEyU9eBBF0T3b lifr08DDXT5JboSal02P1upHedrYhZCwE5dyDTJbj6p5Z/30vtWZ83jq7CG3m11nIjMl XiVKNaZlUkYVbq80m8fBfzQ1BYW86WOfc936QKkdFqzuElOX6i+nPF1Fc7RAM1KTAuCG xS7Hk1y+hkKR5U5Yqfb4ftfgXZ9k5hrCMrwv0cTT1mKR39ITG6rEt586EnYTbt2pPJY6 MI+w== X-Gm-Message-State: AE9vXwOvm9gH1OqEBrHlxZtNlC8H2nwwtX3wV0+LpkuwoQ/RCx1f2yY3MOMo0xLgPh8LvQ== X-Received: by 10.66.81.201 with SMTP id c9mr13744015pay.14.1473493438391; Sat, 10 Sep 2016 00:43:58 -0700 (PDT) Received: from localhost.localdomain.localdomain (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id x126sm9976496pfx.61.2016.09.10.00.43.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Sep 2016 00:43:57 -0700 (PDT) From: Wei Yongjun To: Paul Moore , Stephen Smalley , Eric Paris , James Morris , "Serge E. Hallyn" , William Roberts Subject: [PATCH -next] SELinux: fix error return code in policydb_read() Date: Sat, 10 Sep 2016 07:43:48 +0000 Message-Id: <1473493428-26786-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 12 Sep 2016 08:13:50 -0400 X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: Cc: linux-security-module@vger.kernel.org, Wei Yongjun , selinux@tycho.nsa.gov Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun Fix to return error code -EINVAL from the error handling case instead of 0(rc is overwrite to 0 when policyvers >= POLICYDB_VERSION_ROLETRANS), as done elsewhere in this function. Signed-off-by: Wei Yongjun --- security/selinux/ss/policydb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 8c661f0..ace6838 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -2417,6 +2417,7 @@ int policydb_read(struct policydb *p, void *fp) } else tr->tclass = p->process_class; + rc = -EINVAL; if (!policydb_role_isvalid(p, tr->role) || !policydb_type_isvalid(p, tr->type) || !policydb_class_isvalid(p, tr->tclass) ||