From patchwork Mon Apr 12 08:38:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 419980 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=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 2BE3AC433ED for ; Mon, 12 Apr 2021 09:02:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0486B6137B for ; Mon, 12 Apr 2021 09:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239358AbhDLJDL (ORCPT ); Mon, 12 Apr 2021 05:03:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:54564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239848AbhDLJB1 (ORCPT ); Mon, 12 Apr 2021 05:01:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 07CD06134F; Mon, 12 Apr 2021 08:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217972; bh=VETq8M92MQad2G4dgAI3fdGXIdBzdwZeeA/k/MwVQLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2BFCcSzIEiMNF9OAGbes2tDLH1vjEkZ85J5Vfk/MpdRF40QJnrKO8wwVZTHH9HwCA mY3/vh8xVqNpmxralIZhhYsCcGZIoQIjAR6LvJdaRmWjHOVlEp4g00vlOnriyHvGX9 hbgjYz7AE5KxxSSxG1aCC+CFh1UWDsGczVIVnm+I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maciek Borzecki , Shyam Prasad N , Steve French Subject: [PATCH 5.11 025/210] cifs: escape spaces in share names Date: Mon, 12 Apr 2021 10:38:50 +0200 Message-Id: <20210412084016.848914696@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084016.009884719@linuxfoundation.org> References: <20210412084016.009884719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Maciek Borzecki commit 0fc9322ab5e1fe6910c9673e1a7ff29f7dd72611 upstream. Commit 653a5efb849a ("cifs: update super_operations to show_devname") introduced the display of devname for cifs mounts. However, when mounting a share which has a whitespace in the name, that exact share name is also displayed in mountinfo. Make sure that all whitespace is escaped. Signed-off-by: Maciek Borzecki CC: # 5.11+ Reviewed-by: Shyam Prasad N Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/cifsfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -475,7 +475,8 @@ static int cifs_show_devname(struct seq_ seq_puts(m, "none"); else { convert_delimiter(devname, '/'); - seq_puts(m, devname); + /* escape all spaces in share names */ + seq_escape(m, devname, " \t"); kfree(devname); } return 0;