Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8BE7F3C73FF for ; Tue, 17 Mar 2026 13:01:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773752493; cv=none; b=BSdws+86s8cbJMqctf69SD82fcpSUAhQccom/9q2Xqez6rZZ051vmgI049r3zSsUk5GS/ZeO3sry0HQfP3JqChIuxxtPuKPrpf0fysm0zbxHz88Zu9ynhz6rPkjfHu9Fi7aiOVnG7CTpIDUCApQlO4VKK1qMrPmp8ycWOVXV+WQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773752493; c=relaxed/simple; bh=p4921i0ucvJgLxpND8lIDc4NBfoKyc1Ym8iuPkcugY4=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=QBNGjrh30/32xeyjr4aGktF4Kg1AW+AyTA9FgU4yLxn4Rnt2Ckq1+Iz3iL5iRNqLksYxnYM3bt83ux9yUUSzBk2+ezW8UK6titeZQ6VwUVLfMnvWM4jUCCMHvteuUUOaSvJ20RxTOJhzsl6bewRSfxxlxwJqHUxCISauEJSDjpM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yp9Wm7Bf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yp9Wm7Bf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91CEDC2BCB0; Tue, 17 Mar 2026 13:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1773752493; bh=p4921i0ucvJgLxpND8lIDc4NBfoKyc1Ym8iuPkcugY4=; h=Subject:To:Cc:From:Date:From; b=yp9Wm7Bf7V4qz6wekGQWeCDUXhdehFZgN8pamKg1cINaHFxk7ov51b3bf4HfUtlXW aFI2cg81C5E6Cojlsx+hx1MYgLWhXZrvyVuyx6roTJbrLr3TSER5OwedN6O+ZIm3vI 0vpfb2bISUOO6aG6NzdQk3FXfQ0pfbjwantyjXBg= Subject: FAILED: patch "[PATCH] smb: client: fix iface port assignment in" failed to apply to 5.15-stable tree To: henrique.carvalho@suse.com,ematsumiya@suse.de,stfrench@microsoft.com,thomas.orgis@uni-hamburg.de Cc: From: Date: Tue, 17 Mar 2026 14:01:29 +0100 Message-ID: <2026031729-brethren-snowshoe-607a@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x d4c7210d2f3ea481a6481f03040a64d9077a6172 # git commit -s git send-email --to '' --in-reply-to '2026031729-brethren-snowshoe-607a@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From d4c7210d2f3ea481a6481f03040a64d9077a6172 Mon Sep 17 00:00:00 2001 From: Henrique Carvalho Date: Wed, 11 Mar 2026 20:17:23 -0300 Subject: [PATCH] smb: client: fix iface port assignment in parse_server_interfaces parse_server_interfaces() initializes interface socket addresses with CIFS_PORT. When the mount uses a non-default port this overwrites the configured destination port. Later, cifs_chan_update_iface() copies this sockaddr into server->dstaddr, causing reconnect attempts to use the wrong port after server interface updates. Use the existing port from server->dstaddr instead. Cc: stable@vger.kernel.org Fixes: fe856be475f7 ("CIFS: parse and store info on iface queries") Tested-by: Dr. Thomas Orgis Reviewed-by: Enzo Matsumiya Signed-off-by: Henrique Carvalho Signed-off-by: Steve French diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index 7f2d3459cbf9..612057318de2 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -628,6 +628,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, struct smb_sockaddr_in6 *p6; struct cifs_server_iface *info = NULL, *iface = NULL, *niface = NULL; struct cifs_server_iface tmp_iface; + __be16 port; ssize_t bytes_left; size_t next = 0; int nb_iface = 0; @@ -662,6 +663,15 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, goto out; } + spin_lock(&ses->server->srv_lock); + if (ses->server->dstaddr.ss_family == AF_INET) + port = ((struct sockaddr_in *)&ses->server->dstaddr)->sin_port; + else if (ses->server->dstaddr.ss_family == AF_INET6) + port = ((struct sockaddr_in6 *)&ses->server->dstaddr)->sin6_port; + else + port = cpu_to_be16(CIFS_PORT); + spin_unlock(&ses->server->srv_lock); + while (bytes_left >= (ssize_t)sizeof(*p)) { memset(&tmp_iface, 0, sizeof(tmp_iface)); /* default to 1Gbps when link speed is unset */ @@ -682,7 +692,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, memcpy(&addr4->sin_addr, &p4->IPv4Address, 4); /* [MS-SMB2] 2.2.32.5.1.1 Clients MUST ignore these */ - addr4->sin_port = cpu_to_be16(CIFS_PORT); + addr4->sin_port = port; cifs_dbg(FYI, "%s: ipv4 %pI4\n", __func__, &addr4->sin_addr); @@ -696,7 +706,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, /* [MS-SMB2] 2.2.32.5.1.2 Clients MUST ignore these */ addr6->sin6_flowinfo = 0; addr6->sin6_scope_id = 0; - addr6->sin6_port = cpu_to_be16(CIFS_PORT); + addr6->sin6_port = port; cifs_dbg(FYI, "%s: ipv6 %pI6\n", __func__, &addr6->sin6_addr);