Message ID | 1451930639-94331-3-git-send-email-seth.forshee@canonical.com |
---|---|
State | Not Applicable |
Headers | show
Return-Path: <linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 77FFF140326 for <incoming@patchwork.ozlabs.org>; Tue, 5 Jan 2016 05:10:38 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical-com.20150623.gappssmtp.com header.i=@canonical-com.20150623.gappssmtp.com header.b=rZGWD9+x; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aG9YT-00054Z-IS; Mon, 04 Jan 2016 18:08:29 +0000 Received: from mail-io0-x22f.google.com ([2607:f8b0:4001:c06::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aG9Uf-00006r-7i for linux-mtd@lists.infradead.org; Mon, 04 Jan 2016 18:04:43 +0000 Received: by mail-io0-x22f.google.com with SMTP id 77so132119530ioc.2 for <linux-mtd@lists.infradead.org>; 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=FML0E+UJ4NCnVJQBjN1yNWPUdG725x0Bb+pxDd3y6h/vQALSTmWpMYKNC3jbGUB9qI da9ZsMybe9F/bEgXv9CVEN3GlLs88tUWLUT5EEeHHfpxtP/YK9MWRZidYxu59OgAlYlL A4wtRb9rTmRjmHZWmMROVuacLCcFiuje+zi8MOKH8MEZrquQplfNXxP/awRGBuFb5l0e 4By14NJ8kev4fTQjRMh8/wECV8GoWdMgLIMKVpOtsxJAtyfwVfq1AcpzwsSRaEnaZleR UZBuZYcyuaT+1TREWlGK5u9NcDh4h5uSgt8Kx4wmYgk9t2PhQKD1nwU2BMdxaX1ED1rV 8S/A== X-Gm-Message-State: ALoCoQk2xvUQjnI08EKECdtwjKfRikGfS22LXc5LMqfKBkDTPuYEYbvVXcGKIcHAiJJGHuC/qjmB7wmAQTk0N2nYNf7cHrD3ng== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160104_100433_981567_4EBA5AEF X-CRM114-Status: UNSURE ( 9.14 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4001:c06:0:0:0:22f listed in] [list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list <linux-mtd.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-mtd/> List-Post: <mailto:linux-mtd@lists.infradead.org> List-Help: <mailto:linux-mtd-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=subscribe> 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 Sender: "linux-mtd" <linux-mtd-bounces@lists.infradead.org> Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
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;