From patchwork Tue Oct 27 13:45:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 289723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B5DCC5517A for ; Tue, 27 Oct 2020 15:28:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 011AB22283 for ; Tue, 27 Oct 2020 15:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812524; bh=fkpBxmfNOcwEsEY2B5f6l5JmMKKxZmeXpAnX27yXbj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=b3Pxn0Meo9Sfdb8eaR80eB7+L8d6bNR4lgqI0z0TS+2HfyM/VMZDCfRbU6BD29sIU ZWj++UagRxfLTt8kVpCNWYfffg+feqWoaGh24MvyiMrGLRSvWrOIk1FHN0ZmICW+yB HUg3CHTW19FGI0+oj3FGlR6U9FFdHpDNFq39akE0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760819AbgJ0P2j (ORCPT ); Tue, 27 Oct 2020 11:28:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:35218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1796943AbgJ0PUo (ORCPT ); Tue, 27 Oct 2020 11:20:44 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D74F12064B; Tue, 27 Oct 2020 15:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812043; bh=fkpBxmfNOcwEsEY2B5f6l5JmMKKxZmeXpAnX27yXbj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h9ZuT1OdPQpXxde0Xb//74iSaoYD46XjTp5GtBu4b+jNWnRpg0oDOmwvObwR3XxPP j6ayObEFHzHV6ztaoazcdQ/Ip54Cz2KV7yi3gAXZxV9sG9dOYXVjL6eiTQIC6KqU+D cdEdVewDJZjgsdTsP+83PGTBA58oUtlaI3fzvjO0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steve French , Ronnie Sahlberg , Shyam Prasad N Subject: [PATCH 5.9 071/757] smb3: fix stat when special device file and mounted with modefromsid Date: Tue, 27 Oct 2020 14:45:21 +0100 Message-Id: <20201027135453.872928262@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Steve French commit 3c3317daef0afa0cd541fc9c1bfd6ce8bbf1129a upstream. When mounting with modefromsid mount option, it was possible to get the error on stat of a fifo or char or block device: "cannot stat : Operation not supported" Special devices can be stored as reparse points by some servers (e.g. Windows NFS server and when using the SMB3.1.1 POSIX Extensions) but when the modefromsid mount option is used the client attempts to get the ACL for the file which requires opening with OPEN_REPARSE_POINT create option. Signed-off-by: Steve French CC: Stable Reviewed-by: Ronnie Sahlberg Reviewed-by: Shyam Prasad N Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2ops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -3072,7 +3072,12 @@ get_smb2_acl_by_path(struct cifs_sb_info oparms.tcon = tcon; oparms.desired_access = READ_CONTROL; oparms.disposition = FILE_OPEN; - oparms.create_options = cifs_create_options(cifs_sb, 0); + /* + * When querying an ACL, even if the file is a symlink we want to open + * the source not the target, and so the protocol requires that the + * client specify this flag when opening a reparse point + */ + oparms.create_options = cifs_create_options(cifs_sb, 0) | OPEN_REPARSE_POINT; oparms.fid = &fid; oparms.reconnect = false;