From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2nam01on0127.outbound.protection.outlook.com ([104.47.34.127]:21118 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727677AbeH3WLh (ORCPT ); Thu, 30 Aug 2018 18:11:37 -0400 From: Sasha Levin To: "stable@vger.kernel.org" CC: Steven French , Sasha Levin Subject: [PATCH AUTOSEL 4.18 094/113] smb3: if server does not support posix do not allow posix mount option Date: Thu, 30 Aug 2018 18:08:07 +0000 Message-ID: <20180830180714.36167-28-alexander.levin@microsoft.com> References: <20180830180714.36167-1-alexander.levin@microsoft.com> In-Reply-To: <20180830180714.36167-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Steve French [ Upstream commit 8505c8bfd85a260c9dc5c47e15bd8c5357fcbcd2 ] If user specifies "posix" on an SMB3.11 mount, then fail the mount if server does not return the POSIX negotiate context indicating support for posix. Signed-off-by: Steve French Reviewed-by: Aurelien Aptel Signed-off-by: Sasha Levin --- fs/cifs/connect.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 5df2c0698cda..9d02563b2147 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3031,11 +3031,15 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol = *volume_info) } =20 #ifdef CONFIG_CIFS_SMB311 - if ((volume_info->linux_ext) && (ses->server->posix_ext_supported)) { - if (ses->server->vals->protocol_id =3D=3D SMB311_PROT_ID) { + if (volume_info->linux_ext) { + if (ses->server->posix_ext_supported) { tcon->posix_extensions =3D true; printk_once(KERN_WARNING "SMB3.11 POSIX Extensions are experimental\n"); + } else { + cifs_dbg(VFS, "Server does not support mounting with posix SMB3.11 exte= nsions.\n"); + rc =3D -EOPNOTSUPP; + goto out_fail; } } #endif /* 311 */ --=20 2.17.1