From nobody Tue Dec 16 07:12:37 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 306752E7F3A for ; Wed, 25 Jun 2025 16:43:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750869797; cv=none; b=Qm5zYfNxlUSz5BaKLgPzs+78M+Z+JXT/waTy5D4z9sMvlf5++gX9Jfal5ED4sWijH/BNpJid/r4n3qVBUySLUY0LeHE41uHvmW8TODLizEp6RePtx4LaHFgShBxPV4e6anGI1kfLSOjqNUt6cic29iEZ6iPUx+uEaDXhxvBDwm8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750869797; c=relaxed/simple; bh=AliD1klfeZmgo/JTUsJ7G3JGESX3QkE+j7pa6SVp2lI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gQY6gDF1NMWoxP4i4Y9shKVIgc4tRStPfzDB/6a8NQAwErun/8UNbckvZSnY/+42DMO+MsdMOznch7+U7I/aED9c2zSNWPwpCPduOfuHgiFmd4AHS1+tHSdmCGBBMIpIMBXLc5+JFN3+qrcRguFdnHec18MZ6bdu7u1ywZSxdWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=B7ITKsAC; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="B7ITKsAC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750869794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sCzPzgmppSzHAEtxjqlIXf8IEb60t649a5zwc5vulFQ=; b=B7ITKsACuICSqf/X1mt2OjI484KYBYlb7kJzfr0kdL2hcsY5spXz1Xj9Ru2MkQnz5IeqZl Pt3cnaNE0Y2pF55q/f/BCj7nOrk3r7wg3aQad/0lRnWl3HJ3mddrhkmfjRUi90w0KHiAKm IwQ7JYgkIyG0pGAdJpKwjhK5zNjrtR4= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-484-52K8xfSSOnORCP1C4Wa6QA-1; Wed, 25 Jun 2025 12:43:10 -0400 X-MC-Unique: 52K8xfSSOnORCP1C4Wa6QA-1 X-Mimecast-MFC-AGG-ID: 52K8xfSSOnORCP1C4Wa6QA_1750869788 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 21CA1180120D; Wed, 25 Jun 2025 16:43:08 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.81]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E557118003FC; Wed, 25 Jun 2025 16:43:03 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French Cc: David Howells , Paulo Alcantara , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Paulo Alcantara , stable@vger.kernel.org, Remy Monsen , Pierguido Lambri , Steve French Subject: [PATCH v2 09/16] smb: client: fix regression with native SMB symlinks Date: Wed, 25 Jun 2025 17:42:04 +0100 Message-ID: <20250625164213.1408754-10-dhowells@redhat.com> In-Reply-To: <20250625164213.1408754-1-dhowells@redhat.com> References: <20250625164213.1408754-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" From: Paulo Alcantara Some users and customers reported that their backup/copy tools started to fail when the directory being copied contained symlink targets that the client couldn't parse - even when those symlinks weren't followed. Fix this by allowing lstat(2) and readlink(2) to succeed even when the client can't resolve the symlink target, restoring old behavior. Cc: linux-cifs@vger.kernel.org Cc: stable@vger.kernel.org Reported-by: Remy Monsen Closes: https://lore.kernel.org/r/CAN+tdP7y=3Djqw3pBndZAGjQv0ObFq8Q=3D+PUDH= gB36HdEz9QA6FQ@mail.gmail.com Reported-by: Pierguido Lambri Fixes: 12b466eb52d9 ("cifs: Fix creating and resolving absolute NT-style sy= mlinks") Signed-off-by: Paulo Alcantara (Red Hat) Signed-off-by: Steve French Signed-off-by: David Howells --- fs/smb/client/reparse.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c index 511611206dab..1c40e42e4d89 100644 --- a/fs/smb/client/reparse.c +++ b/fs/smb/client/reparse.c @@ -875,15 +875,8 @@ int smb2_parse_native_symlink(char **target, const cha= r *buf, unsigned int len, abs_path +=3D sizeof("\\DosDevices\\")-1; else if (strstarts(abs_path, "\\GLOBAL??\\")) abs_path +=3D sizeof("\\GLOBAL??\\")-1; - else { - /* Unhandled absolute symlink, points outside of DOS/Win32 */ - cifs_dbg(VFS, - "absolute symlink '%s' cannot be converted from NT format " - "because points to unknown target\n", - smb_target); - rc =3D -EIO; - goto out; - } + else + goto out_unhandled_target; =20 /* Sometimes path separator after \?? is double backslash */ if (abs_path[0] =3D=3D '\\') @@ -910,13 +903,7 @@ int smb2_parse_native_symlink(char **target, const cha= r *buf, unsigned int len, abs_path++; abs_path[0] =3D drive_letter; } else { - /* Unhandled absolute symlink. Report an error. */ - cifs_dbg(VFS, - "absolute symlink '%s' cannot be converted from NT format " - "because points to unknown target\n", - smb_target); - rc =3D -EIO; - goto out; + goto out_unhandled_target; } =20 abs_path_len =3D strlen(abs_path)+1; @@ -966,6 +953,7 @@ int smb2_parse_native_symlink(char **target, const char= *buf, unsigned int len, * These paths have same format as Linux symlinks, so no * conversion is needed. */ +out_unhandled_target: linux_target =3D smb_target; smb_target =3D NULL; }