Message ID | 1461339521-123191-6-git-send-email-seth.forshee@canonical.com |
---|---|
State | Superseded |
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 3qs0FX3VTRz9t5C for <incoming@patchwork.ozlabs.org>; Sat, 23 Apr 2016 01:40:48 +1000 (AEST) 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=v7XNmNC3; 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 1atdBD-00023n-Jk; Fri, 22 Apr 2016 15:39:39 +0000 Received: from mail-oi0-x234.google.com ([2607:f8b0:4003:c06::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1atdAz-0001dy-9I for linux-mtd@lists.infradead.org; Fri, 22 Apr 2016 15:39:25 +0000 Received: by mail-oi0-x234.google.com with SMTP id p188so136856194oih.2 for <linux-mtd@lists.infradead.org>; Fri, 22 Apr 2016 08:39:04 -0700 (PDT) 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=H1pQFqDrRZ8xlFfU2kiGyzvLjM9BsNai/2LMUazva60=; b=v7XNmNC3O3i9xPabPZch1+/iLxt8FUQs4+5ewjGSQYWDoqbyhVd2Z1L2RkhsoHBN7B aNGCjVN6SN7hE08tF6WpNz+sM5StsBeU2zmN1SU2ehyX0CIuwaU9ExnhW+wBgMcmlCJz T02XLIu7l2Tm25+tYQK/ffH0kuta8N1mW9ZkvR0yLRlssMZx31okW5tlv4D7vUH2OQ7J /6JCdx+nUmhhWbecJOHQLxqAtF6nDXDsv5myqy+LjbdAS7+4KdMHYZ5ISvEV4s1o3Xbr 9wJUOjD2/4/7oksXMQqJB6rj33PDVnjmiIMsGozsaTzjE0+riDh8QMJ5eEJ5TN0kDfRH lulA== 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=H1pQFqDrRZ8xlFfU2kiGyzvLjM9BsNai/2LMUazva60=; b=ZnwI0Pc4F6xkjOC0Ep7ClpNLQVSPJlLwg7rMFRe/DO9HB1unDoznExeT9ak3LDBLNy P338sy80wPcN8tUo/3OGhmUuvXQRttRbyjqgZeBae/7ArR1DLDxmFpf0cZRx5UNT6+2a 1nnuc50r7Ohzi6ZEY0+IYTu73FZ2MfNpdyl2HHC5Fwn+znidle4Qj2NL9/UbMr5yU2wy g4kBNkIh7I/kjvvYctliPANIZB3keDR0UdCwl7jwE5llM80cmQM2d4TMQ/856bMpUZlc jSkEHX3xkFj6+9F9uTBDw03AeZYnN9JGFDCwqAJqIeuw6xrOBE0XEl5MhcHEbhapsf78 cJgw== X-Gm-Message-State: AOPr4FUh/aSX0k/6lY3jwXRXkgfTSbQx5h/d2ZiGecwxlFDd/R7KAjmaKx+8plLo0m6bu0Ro X-Received: by 10.202.178.135 with SMTP id b129mr8548265oif.139.1461339544249; Fri, 22 Apr 2016 08:39:04 -0700 (PDT) Received: from localhost ([2605:a601:aab:f920:ad1c:41df:dcb1:a4a0]) by smtp.gmail.com with ESMTPSA id e60sm2082684ote.34.2016.04.22.08.39.03 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 22 Apr 2016 08:39:03 -0700 (PDT) From: Seth Forshee <seth.forshee@canonical.com> To: "Eric W. Biederman" <ebiederm@xmission.com>, Alexander Viro <viro@zeniv.linux.org.uk> Subject: [PATCH v3 05/21] block_dev: Check permissions towards block device inode when mounting Date: Fri, 22 Apr 2016 10:38:22 -0500 Message-Id: <1461339521-123191-6-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461339521-123191-1-git-send-email-seth.forshee@canonical.com> References: <1461339521-123191-1-git-send-email-seth.forshee@canonical.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160422_083925_434029_DAF5A245 X-CRM114-Status: UNSURE ( 8.62 ) 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:4003:c06:0:0:0:234 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: linux-bcache@vger.kernel.org, Serge Hallyn <serge.hallyn@canonical.com>, Seth Forshee <seth.forshee@canonical.com>, dm-devel@redhat.com, Miklos Szeredi <mszeredi@redhat.com>, Richard Weinberger <richard.weinberger@gmail.com>, linux-security-module@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, cgroups@vger.kernel.org, Pavel Tikhomirov <ptikhomirov@virtuozzo.com> 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 e9b937845bdb..2007040afb7b 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1429,9 +1429,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;