From patchwork Fri Sep 23 12:24:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 674050 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3sgXbt3XHtz9t14; Fri, 23 Sep 2016 22:24:26 +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=Eif4nmt6; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1bnPWh-0007Qr-Kz; Fri, 23 Sep 2016 12:24:23 +0000 Received: from mail-oi0-f50.google.com ([209.85.218.50]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1bnPWX-0007KD-Tk for kernel-team@lists.ubuntu.com; Fri, 23 Sep 2016 12:24:14 +0000 Received: by mail-oi0-f50.google.com with SMTP id a62so132339739oib.1 for ; Fri, 23 Sep 2016 05:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=WG+Mb/zPQB55fXA1/PIkMOFu1pmfyuLxo1xSbKMW4bw=; b=Eif4nmt6swZ0JM25d9uLVbiYYyyzJQc2tEPWOSFt6GDMryylZgWPHMS4DFs/WpO/QY euOX4+ucFzvtadZ3i60tOcyXMelwS2XEUmtg7dOid215K5llwCenHUbTlhGaaioWWtqD 4m4n4f5u17YJTzF7zS5Jrdg9os9mFHRHzC/+a2CuefQCb2MCOqUwCIaRjAQH568eWCMV yhUo49fOSj6mZuayDHv3o8uoW2/KKAQB9ObhugT8e/Mtif4kejYzHt7f+gVrQti3JJR8 W6m8IHLbc3aVKuSkZlqe8pKeUzGAmxy0b4+oGpFHXQOmUhX2QBD4GggSomZJmevBCstO rHcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=WG+Mb/zPQB55fXA1/PIkMOFu1pmfyuLxo1xSbKMW4bw=; b=HQIpUG9VgF8tGZ0XBDpRJZIkmVtYFZ1JucEH+VxP6m1GKRfNVtDh8oXgJLqPsvF7rB hR6d+WNLBqy2OMA9x6PYHa64TytVyDJpJwU93rfhIuPMua66lQwA8YVuegI2wqcsAqBi 9tFoyDDtuRK23AsCKfardNl/vr4ZH7wwUdpx27kEyaXkc5hYdb2LwR6lSG4ctnLRSSpV 6faHGGZ6SK7yWlkcIgie4ZXbBMqbZTfPWRLyokjg+zu1CaHHgFBydStvpHo2J0gWB+Wr p9GTeubci+IlvIUa6rjhN4M7CXnfwwoFgPYC02pRlPai9ixQ47iuz+qxCrtrGb/OLKKR 6+uQ== X-Gm-Message-State: AA6/9RmoXsLZvmOFDV4HbAfXlyeQhLP7ceJB9Mp5xzs/KbYqmTQKRiDuYBoSEcQXEi5Xao7p X-Received: by 10.202.222.138 with SMTP id v132mr2643785oig.140.1474633452576; Fri, 23 Sep 2016 05:24:12 -0700 (PDT) Received: from localhost ([2605:a601:aa9:6620:b807:45e0:cc12:ed6e]) by smtp.gmail.com with ESMTPSA id 63sm1994666oth.28.2016.09.23.05.24.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Sep 2016 05:24:12 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/3][xenial SRU] Compare prepaths when comparing superblocks Date: Fri, 23 Sep 2016 07:24:07 -0500 Message-Id: <1474633449-52911-3-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474633449-52911-1-git-send-email-seth.forshee@canonical.com> References: <1474633449-52911-1-git-send-email-seth.forshee@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Sachin Prabhu BugLink: http://bugs.launchpad.net/bugs/1626112 The patch fs/cifs: make share unaccessible at root level mountable makes use of prepaths when any component of the underlying path is inaccessible. When mounting 2 separate shares having different prepaths but are other wise similar in other respects, we end up sharing superblocks when we shouldn't be doing so. Signed-off-by: Sachin Prabhu Tested-by: Aurelien Aptel Signed-off-by: Steve French (cherry picked from commit c1d8b24d18192764fe82067ec6aa8d4c3bf094e0) Signed-off-by: Seth Forshee --- fs/cifs/connect.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 94e6982..b5c5aa6 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2812,6 +2812,24 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data) return 1; } +static int +match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data) +{ + struct cifs_sb_info *old = CIFS_SB(sb); + struct cifs_sb_info *new = mnt_data->cifs_sb; + + if (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) { + if (!(new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH)) + return 0; + /* The prepath should be null terminated strings */ + if (strcmp(new->prepath, old->prepath)) + return 0; + + return 1; + } + return 0; +} + int cifs_match_super(struct super_block *sb, void *data) { @@ -2839,7 +2857,8 @@ cifs_match_super(struct super_block *sb, void *data) if (!match_server(tcp_srv, volume_info) || !match_session(ses, volume_info) || - !match_tcon(tcon, volume_info->UNC)) { + !match_tcon(tcon, volume_info->UNC) || + !match_prepath(sb, mnt_data)) { rc = 0; goto out; }