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: 9324779 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 758A560780 for ; Sat, 10 Sep 2016 07:44:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30EF929AD8 for ; Sat, 10 Sep 2016 07:44:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 254D729B3B; Sat, 10 Sep 2016 07:44:01 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 BE7F929AD8 for ; Sat, 10 Sep 2016 07:44:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754822AbcIJHn7 (ORCPT ); Sat, 10 Sep 2016 03:43:59 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:33792 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754260AbcIJHn7 (ORCPT ); Sat, 10 Sep 2016 03:43:59 -0400 Received: by mail-pa0-f65.google.com with SMTP id bu8so228041pab.1 for ; Sat, 10 Sep 2016 00:43:58 -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=JDCJP8E3RmcZ8LK9GmInzg4aD6czztcuSrA0uD7jpg4QLc/zAcXU5NCjx29lxK56La pmSOvlDh0mtTUALI/R1X9MPRNo1sbWmBHXTtOeohAn/i1wsd+uNWp4C1OAKZlxNCqzXR JvQzQ3ySRFvDNi1SYJsZmoU0dp3Jfl3WndbPrIFBunaqrt+sKc0XiVqGeYp/jGOqXpXE a9zl74QqZYeJKswv59X+IADtaEhI8zUQ8vfjGxgIvu8PNnooJ8kIqO+T+jXiTXB1dz1P fJIE0aL2Woa9UIUXuQ/A0euwJSrg0+E61l8GNUxiCmnpeHPPSk8/VskENluJXT9gGlS/ ttKw== X-Gm-Message-State: AE9vXwOQK2cgiRPba07+LvLRLZdhMZOhEXa+bKBHvcA5nTb5culZKd9QcqkOtQsPWDfiAw== 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 Cc: Wei Yongjun , selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org 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 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: 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(+) -- 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/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) ||