From patchwork Tue Jul 23 18:21:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 13740291 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E51E8155351 for ; Tue, 23 Jul 2024 18:22:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721758922; cv=none; b=lHD2SM72GeDC9eEBbG4jFvzdKfA06lVF3h0Ce0WsjsswuPH65vA+fBPJ+8rfJiaZix+LvUnMjRJgaQbBhttS33UCfXH1U2zvAgsc/WiSHwODcOOBIRj7ioZ8hsFJ/bpIPERGCzDkUjEXB97YToDO+VlJnOSq7KNVNQgEPjNnUOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721758922; c=relaxed/simple; bh=W7Ocuv5f9u6PWSR+f1swXfGThreB6aVEOmQ6vGDpg+c=; h=MIME-Version:From:Date:Message-ID:Subject:To:Content-Type; b=sJavuYu3zugVnjSEO8UGu6dvTUCPTX8iKuB0DzGQqzpwHmdEjCVZ7AXfwwB9SkjcJsQQTwOMqfT8fEmm3UNQetX9n3TGMJVLNVqneQ91QSZdl1dsyNjh9QxIclCtzn/nTTMNf1I4m8VcLUUvQR+GCcFpFj/kowhxM/6Ppzkuo2U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JsaCZN/F; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JsaCZN/F" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-52efba36802so4220621e87.2 for ; Tue, 23 Jul 2024 11:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721758919; x=1722363719; darn=vger.kernel.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=1XDoX4Al4RHvx68f0zteTAdo2hXftFjzCiJ1b8jFKKs=; b=JsaCZN/Fv43uSfBPFBacBWEd3Cfc5yZhRjPbeeRQq27lmwuAo7AdntPemQxJlaLao2 WJhzaehWbOkvul4lLnpVe/03ncUnjSk5eeVd1XddufnlSq32xydwHcPqnGdJpkH8lg30 Rm2k3pqtavAQFvaFTYTGD0mwJI8EIA5bdZms69NbkiisjWN1er/VxzUu8jPAEuExp2z5 tJ4/2nnz5xHQN8RBSkhfQa+Ylv1Xe90HTCHKq6V8gYn20XPhezykeTx4axOMzMcBX3Vj OiItEcLp4Dv8RnPpjU1e/2dyi6VCt8ygLYlKsCpjaRyuLKb3E3r2A693YUV+p7u3EkUS RRVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721758919; x=1722363719; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=1XDoX4Al4RHvx68f0zteTAdo2hXftFjzCiJ1b8jFKKs=; b=g4AunapD6zimr+mYvtx42Wzm673B+mllY1bfwR8ztGp3wi94R6582faABANTywHk7D o+uqC24Ez//JIHHAC/wd5F+2bKXCVqp/DzMn5tzs2xlo457XT4oB9JJeo5UsH17k3K3/ yNXLylSPtgnT1dPtGq8fmLQuhs0ufESIa/zPPIrWSvz28/sjbnZhidBxQeUZEqhgzXWE 8FuRP6B3HUPaxwiVMAHgUNbD6J6R4rZHhr7AUp2YEb/RkRJB49EtpLhkgRp1VLpqFAnQ Q526Sky/tjBLAgmrl0s3dtFTNC65k7Ve+rNpnGggv8Nsj/jgc/Ab3x0sdy3Ifc7xWq51 4CqA== X-Forwarded-Encrypted: i=1; AJvYcCXsWhs63gYp/uXZJRhLHERH7Foswk2kd+wzhdh6ark1uczByy5jvKqRhyU1ds2+2qic8hpflKjkUfbZXm/nX4Jp9tHjDC9x/xoTgQ== X-Gm-Message-State: AOJu0Yx8XUroaTVa560SSNiwtWvB3oXksBo6PRakno/BZGM4DBeutsTy cxz3PJlEuB3tWTIIP89SKBeFz1RF1A2maY0bwLPG+aMMn5FaigctjP343Ag7WAIQWS8Ym+NKqtt hXZbX4YtZmFkWLRNGfr4TeDxBSao= X-Google-Smtp-Source: AGHT+IE//9pP+xUM5Z92LifXTaCHkgutPFZPFbJlPTZPd0lSuB9uG7JM6RyKFz4IyOl1s5Jcmp1CndwtZKmh0qsjyEw= X-Received: by 2002:a05:6512:b21:b0:52e:a60e:3a04 with SMTP id 2adb3069b0e04-52efb85af78mr6876338e87.59.1721758918723; Tue, 23 Jul 2024 11:21:58 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Steve French Date: Tue, 23 Jul 2024 13:21:45 -0500 Message-ID: Subject: [PATCH v2][CIFS] mount with "unix" mount option for SMB1 incorrectly handled To: samba-technical , CIFS , Paulo Alcantara Lightly updated to include feedback from Paulo and add the reviewed-by From 36a3ad2528735c4007ade8520b65143b57400812 Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 23 Jul 2024 00:44:48 -0500 Subject: [PATCH] cifs: mount with "unix" mount option for SMB1 incorrectly handled Although by default we negotiate CIFS Unix Extensions for SMB1 mounts to Samba (and they work if the user does not specify "unix" or "posix" or "linux" on mount), and we do properly handle when a user turns them off with "nounix" mount parm. But with the changes to the mount API we broke cases where the user explicitly specifies the "unix" option (or equivalently "linux" or "posix") on mount with vers=1.0 to Samba or other servers which support the CIFS Unix Extensions. "mount error(95): Operation not supported" and logged: "CIFS: VFS: Check vers= mount option. SMB3.11 disabled but required for POSIX extensions" even though CIFS Unix Extensions are supported for vers=1.0 This patch fixes the case where the user specifies both "unix" (or equivalently "posix" or "linux") and "vers=1.0" on mount to a server which supports the CIFS Unix Extensions. Cc: stable@vger.kernel.org Reviewed-by: David Howells Reviewed-by: Paulo Alcantara (Red Hat) Signed-off-by: Steve French --- fs/smb/client/connect.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index b66d8b03a389..80223007bce4 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -2614,6 +2614,14 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) cifs_dbg(VFS, "Server does not support mounting with posix SMB3.11 extensions\n"); rc = -EOPNOTSUPP; goto out_fail; + } else if (ses->server->vals->protocol_id == SMB10_PROT_ID) + if (cap_unix(ses)) + cifs_dbg(FYI, "Unix Extensions requested on SMB1 mount\n"); + else { + cifs_dbg(VFS, "SMB1 Unix Extensions not supported by server: %s\n", + ses->server->hostname); + rc = -EOPNOTSUPP; + goto out_fail; } else { cifs_dbg(VFS, "Check vers= mount option. SMB3.11 disabled but required for POSIX extensions\n"); -- 2.43.0