From patchwork Tue Mar 15 12:09:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Tikhomirov X-Patchwork-Id: 8587551 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C0F2D9F44D for ; Tue, 15 Mar 2016 12:10:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5FFC202C8 for ; Tue, 15 Mar 2016 12:10:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B2F2920155 for ; Tue, 15 Mar 2016 12:10:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934601AbcCOMKq (ORCPT ); Tue, 15 Mar 2016 08:10:46 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:10756 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932688AbcCOMKq (ORCPT ); Tue, 15 Mar 2016 08:10:46 -0400 Received: from dhcp-10-30-28-101.sw.ru ([10.30.16.121]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u2FC92u5021475; Tue, 15 Mar 2016 15:09:03 +0300 (MSK) From: Pavel Tikhomirov To: Andy Lutomirski , Seth Forshee , "Eric W. Biederman" , Cc: Serge Hallyn , Alexander Viro , linux-security-module@vger.kernel.org, linux-mtd@lists.infradead.org, selinux@tycho.nsa.gov, linux-fsdevel@vger.kernel.org, Pavel Tikhomirov , Konstantin Khorenko , Pavel Emelyanov Subject: [PATCH] fs: remove excess check for in_userns Date: Tue, 15 Mar 2016 15:09:00 +0300 Message-Id: <1458043740-14229-1-git-send-email-ptikhomirov@virtuozzo.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1451930639-94331-4-git-send-email-seth.forshee@canonical.com> References: <1451930639-94331-4-git-send-email-seth.forshee@canonical.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If in_userns returns false mnt_may_suid also returns false, and we will reach second(removed) if-check only in case it does not trigger, so remove it. Signed-off-by: Pavel Tikhomirov --- security/commoncap.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/security/commoncap.c b/security/commoncap.c index ca0c04ae..82f930c 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -445,8 +445,6 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c if (!mnt_may_suid(bprm->file->f_path.mnt)) return 0; - if (!in_userns(current_user_ns(), bprm->file->f_path.mnt->mnt_sb->s_user_ns)) - return 0; dentry = dget(bprm->file->f_dentry);