Message ID | 1451930639-94331-3-git-send-email-seth.forshee@canonical.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <selinux-bounces@tycho.nsa.gov> X-Original-To: patchwork-selinux@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 9DB229F350 for <patchwork-selinux@patchwork.kernel.org>; Mon, 4 Jan 2016 18:21:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E8DFA202C8 for <patchwork-selinux@patchwork.kernel.org>; Mon, 4 Jan 2016 18:21:41 +0000 (UTC) Received: from emvm-gh1-uea08.nsa.gov (emvm-gh1-uea08.nsa.gov [63.239.67.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B4C0202B8 for <patchwork-selinux@patchwork.kernel.org>; Mon, 4 Jan 2016 18:21:40 +0000 (UTC) X-TM-IMSS-Message-ID: <75c49e3c00103b91@nsa.gov> Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by nsa.gov ([10.208.42.193]) with ESMTP (TREND IMSS SMTP Service 7.1) id 75c49e3c00103b91 ; Mon, 4 Jan 2016 13:19:28 -0500 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 u04IIbkD014983; Mon, 4 Jan 2016 13:18:39 -0500 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 u04I4ECi225720 for <selinux@prometheus.infosec.tycho.ncsc.mil>; Mon, 4 Jan 2016 13:04:14 -0500 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 u04I4Bea013312 for <selinux@tycho.nsa.gov>; Mon, 4 Jan 2016 13:04:14 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1CSAAAys4pWm7bfVdFeGQEBAQEPAQEBAYRJiFm1aIYPAoFoAQEBAQEBEgEBAQEBBgsLCSGEYwEBAQMSLgEBNwEPUTQBBQEcBgESIogNok6BMT4xileFVAEFjB4BAQEBAQEBAwIBGgYKhDuCEYkjhRiONYhWjy2HPYViRIUUhxY1gReCaA0VBx2BX1MBg0QCHgeBJAEBAQ X-IPAS-Result: A1CSAAAys4pWm7bfVdFeGQEBAQEPAQEBAYRJiFm1aIYPAoFoAQEBAQEBEgEBAQEBBgsLCSGEYwEBAQMSLgEBNwEPUTQBBQEcBgESIogNok6BMT4xileFVAEFjB4BAQEBAQEBAwIBGgYKhDuCEYkjhRiONYhWjy2HPYViRIUUhxY1gReCaA0VBx2BX1MBg0QCHgeBJAEBAQ X-IronPort-AV: E=Sophos;i="5.20,521,1444708800"; d="scan'208";a="5070744" Received: from emvm-gh1-uea08.nsa.gov ([10.208.42.193]) by goalie.tycho.ncsc.mil with ESMTP; 04 Jan 2016 13:04:12 -0500 X-TM-IMSS-Message-ID: <75b6468b00103455@nsa.gov> Received: from mail-io0-f182.google.com (mail-io0-f182.google.com [209.85.223.182]) by nsa.gov ([10.208.42.193]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 AES128-SHA (128/128)) id 75b6468b00103455 ; Mon, 4 Jan 2016 13:03:48 -0500 Received: by mail-io0-f182.google.com with SMTP id 1so116153069ion.1 for <selinux@tycho.nsa.gov>; Mon, 04 Jan 2016 10:04:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KwI1s3gwjCl10xkZ9B7vbZUHX5GBLc5P+FmDmpdIksM=; b=rZGWD9+xAQf7dpk5vv/narvl2C70jsbzAqNKjsGZph4WBONvnuiwpo5P3+ZFEOj5C0 hm+8pWdGQklUENXtWHD/0nbVHwIhJeFlp4XHGjs5Mqtv7d2sRZzrdd+plT/rMO83xcpX guhUxzSx3IDn/5EXnQ+02HtT9N3pYGLTxLO0gmaWtms6zs0u9kUKryWhsHrHth9/tHsw 9ik27Zn5yv16nP9bFDqZOCJdSXjkWazXANqMXiU/N0W52X2G2xiXXBtXNNMbyEIP4k8S Z+HZNRjVHv/p9xMnElneLet9/nnOFYwDZ3gwC2YLRmBnifaAi3BvAE++SicWkx5PKyQx eaWw== 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:in-reply-to :references; bh=KwI1s3gwjCl10xkZ9B7vbZUHX5GBLc5P+FmDmpdIksM=; b=hIewvTWkYxAUiz6gRbMbXT5bYNT9eYQQxxAERDuXtsg5jxSUXk6a8Ua+bumMWzlpV8 WPyAsCAp3MfPI02odEdzqxDsA83qXCBp+/tQk2HL0+Af42BGKxGH3pG0cqwSVXR9HBM+ VrJ1rhDAUsOto2xgZ6xRWFqajWs65WJ9s+1xCxQvt0lDsDnyv4dtFkt3WjHXAsuNK9aR EW3rXJVU0+ciDZ+p735mkMMqkfvhUkhcpiafQg31f31tbS2zORBm2RnosZdbN4jF4LJ7 EUIu//SdMigx+6EmfxTspA8pC6pYjolwcahr7MR0eqYzSxruhUCcoTvjmK5rTcvK9jhf Hzmg== X-Gm-Message-State: ALoCoQlIqokX5uEt9UKOZFjoBRK525SlFPPkukkEwnAz81ldd5gZrDesvtEPpQrYqhesbKYymDfqdwr6hegLcZ9j7zrFPT+dWA== X-Received: by 10.107.35.146 with SMTP id j140mr24839511ioj.197.1451930652016; Mon, 04 Jan 2016 10:04:12 -0800 (PST) Received: from localhost ([66.64.121.229]) by smtp.gmail.com with ESMTPSA id j136sm10753671ioj.32.2016.01.04.10.04.11 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 04 Jan 2016 10:04:11 -0800 (PST) From: Seth Forshee <seth.forshee@canonical.com> To: "Eric W. Biederman" <ebiederm@xmission.com>, Alexander Viro <viro@zeniv.linux.org.uk> Subject: [PATCH RESEND v2 02/18] block_dev: Check permissions towards block device inode when mounting Date: Mon, 4 Jan 2016 12:03:41 -0600 Message-Id: <1451930639-94331-3-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1451930639-94331-1-git-send-email-seth.forshee@canonical.com> References: <1451930639-94331-1-git-send-email-seth.forshee@canonical.com> X-TM-AS-MML: disable X-Mailman-Approved-At: Mon, 04 Jan 2016 13:14:22 -0500 X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" <selinux.tycho.nsa.gov> List-Post: <mailto:selinux@tycho.nsa.gov> List-Help: <mailto:selinux-request@tycho.nsa.gov?subject=help> Cc: Serge Hallyn <serge.hallyn@canonical.com>, Seth Forshee <seth.forshee@canonical.com>, dm-devel@redhat.com, Miklos Szeredi <miklos@szeredi.hu>, Richard Weinberger <richard.weinberger@gmail.com>, linux-security-module@vger.kernel.org, linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, fuse-devel@lists.sourceforge.net, Austin S Hemmelgarn <ahferroin7@gmail.com>, linux-mtd@lists.infradead.org, selinux@tycho.nsa.gov, linux-fsdevel@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" <selinux-bounces@tycho.nsa.gov> X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 3ebbde85d898..4fdb6ab59816 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1424,9 +1424,14 @@ struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, void *holder) { struct block_device *bdev; + int perm = 0; int err; - bdev = lookup_bdev(path, 0); + if (mode & FMODE_READ) + perm |= MAY_READ; + if (mode & FMODE_WRITE) + perm |= MAY_WRITE; + bdev = lookup_bdev(path, perm); if (IS_ERR(bdev)) return bdev;