From a50eba1e778ad4da5b6f9ddbbf57dabbea59bc05 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Wed, 22 Jul 2026 18:28:37 -0300 Subject: [PATCH] net: dns_resolver: allow shorter names in dns_query() Customer reported a problem with mounting CIFS shares where the server hostname was 2 chars long. Turned out that the CIFS client wasn't able to resolve NetBIOS names shorter than 3 chars. Fix this by allowing a minimum of one character per hostname in dns_query(). Reproducer with samba server: # 'ab' and 'srv' hotnames resolve to same ip address $ ssh srv ln -s 'msdfs:\\ab\\share' /home/shares/dfs/link1 $ mount.cifs //srv/dfs/link1 /mnt -o ... [EINVAL] Reported-by: Pierguido Lambri Signed-off-by: Paulo Alcantara Acked-by: David Howells Acked-by: Frank Sorenson Link: https://patch.msgid.link/20260722-net-dns_resolver-v1-1-c3385898ccf9@manguebit.org Signed-off-by: Jakub Kicinski --- net/dns_resolver/dns_query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c index 14bee83cbe22..b8fb9a1245bf 100644 --- a/net/dns_resolver/dns_query.c +++ b/net/dns_resolver/dns_query.c @@ -72,7 +72,7 @@ int dns_query(struct net *net, kenter("%s,%*.*s,%zu,%s", type, (int)namelen, (int)namelen, name, namelen, options); - if (!name || namelen < 3 || namelen > 255) + if (!name || namelen < 1 || namelen > 255) return -EINVAL; if (type && *type == '\0') return -EINVAL;