lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260210141219.1573869-1-arnd@kernel.org>
Date: Tue, 10 Feb 2026 15:12:05 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Namjae Jeon <linkinjeon@...nel.org>,
	Steve French <smfrench@...il.com>,
	Sang-Soo Lee <constant.lee@...sung.com>,
	Bahubali B Gumaji <bahubali.bg@...sung.com>,
	Hyunchul Lee <hyc.lee@...il.com>
Cc: Arnd Bergmann <arnd@...db.de>,
	Sergey Senozhatsky <senozhatsky@...omium.org>,
	Tom Talpey <tom@...pey.com>,
	Stefan Metzmacher <metze@...ba.org>,
	ChenXiaoSong <chenxiaosong@...inos.cn>,
	David Howells <dhowells@...hat.com>,
	linux-cifs@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] ksmbd: fix non-IPv6 build

From: Arnd Bergmann <arnd@...db.de>

The newly added procfs code fails to build when CONFIG_IPv6 is disabled:

fs/smb/server/connection.c: In function 'proc_show_clients':
fs/smb/server/connection.c:47:58: error: 'struct ksmbd_conn' has no member named 'inet6_addr'; did you mean 'inet_addr'?
   47 |                         seq_printf(m, "%-20pI6c", &conn->inet6_addr);
      |                                                          ^~~~~~~~~~
      |                                                          inet_addr
make[7]: *** [scripts/Makefile.build:279: fs/smb/server/connection.o] Error 1
fs/smb/server/mgmt/user_session.c: In function 'show_proc_sessions':
fs/smb/server/mgmt/user_session.c:215:65: error: 'struct ksmbd_conn' has no member named 'inet6_addr'; did you mean 'inet_addr'?
  215 |                         seq_printf(m, " %-40pI6c", &chan->conn->inet6_addr);
      |                                                                 ^~~~~~~~~~
      |                                                                 inet_addr

Rearrange the condition to allow adding a simple preprocessor conditional.

Fixes: b38f99c1217a ("ksmbd: add procfs interface for runtime monitoring and statistics")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
Alternatively, the corresponding check in the ksmbd_conn could be removed,
which would waste a few bytes per connection but avoid the #ifdef.
---
 fs/smb/server/connection.c        | 8 +++++---
 fs/smb/server/mgmt/user_session.c | 8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/fs/smb/server/connection.c b/fs/smb/server/connection.c
index f0bd244e7d55..e7e3e77006b1 100644
--- a/fs/smb/server/connection.c
+++ b/fs/smb/server/connection.c
@@ -41,10 +41,12 @@ static int proc_show_clients(struct seq_file *m, void *v)
 		jiffies_to_timespec64(jiffies - conn->last_active, &t);
 		ktime_get_real_ts64(&now);
 		t = timespec64_sub(now, t);
-		if (conn->inet_addr)
-			seq_printf(m, "%-20pI4", &conn->inet_addr);
-		else
+#if IS_ENABLED(CONFIG_IPV6)
+		if (!conn->inet_addr)
 			seq_printf(m, "%-20pI6c", &conn->inet6_addr);
+		else
+#endif
+			seq_printf(m, "%-20pI4", &conn->inet_addr);
 		seq_printf(m, "   0x%-10x %-10u %-12d %-10d %ptT\n",
 			   conn->dialect,
 			   conn->total_credits,
diff --git a/fs/smb/server/mgmt/user_session.c b/fs/smb/server/mgmt/user_session.c
index 68b3e0cb54d3..47ce759c231e 100644
--- a/fs/smb/server/mgmt/user_session.c
+++ b/fs/smb/server/mgmt/user_session.c
@@ -209,10 +209,12 @@ static int show_proc_sessions(struct seq_file *m, void *v)
 		down_read(&chan->conn->session_lock);
 		ksmbd_user_session_get(session);
 
-		if (chan->conn->inet_addr)
-			seq_printf(m, " %-40pI4", &chan->conn->inet_addr);
-		else
+#if IS_ENABLED(CONFIG_IPV6)
+		if (!chan->conn->inet_addr)
 			seq_printf(m, " %-40pI6c", &chan->conn->inet6_addr);
+		else
+#endif
+			seq_printf(m, " %-40pI4", &chan->conn->inet_addr);
 		seq_printf(m, " %-15s %-10llu %-10s\n",
 			   session_user_name(session),
 			   session->id,
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ