Article View: linux.kernel.netdev
Article #9637[PATCH net 1/2] connector/cn_proc: reject invalid mcast_op before touching socket state
From: "Cen Zhang (Microsoft)"
Date: Mon, 02 Nov 2026 13:09
Date: Mon, 02 Nov 2026 13:09
59 lines
10168 bytes
10168 bytes
cn_proc_mcast_ctl() does not validate mcast_op before storing it in the
per-socket proc_input, so an invalid value is kept as the socket's
state. The IGNORE case only tests prev_mc_op != PROC_CN_MCAST_IGNORE, so
a following PROC_CN_MCAST_IGNORE decrements proc_event_num_listeners for
a socket that never did LISTEN.
Since commit bfdfdc2f3b70
("connector/cn_proc: Allow non-root users access") any user in the initial
namespaces can send these messages. Alternating an invalid operation and
IGNORE drives the count negative; every proc_*_connector() then returns
early and no process events are delivered to any subscriber, including
root-owned monitors.
Fix by rejecting an operation other than LISTEN or IGNORE before any
per-socket state is created or modified. The default case of the switch
becomes unreachable and is removed.
Fixes: 2aa1f7a1f47c ("connector/cn_proc: Add filtering to fix some bugs")
Cc: stable@vger.kernel.org
Cc: AutonomousCodeSecurity@microsoft.com
Signed-off-by: Cen Zhang (Microsoft) <cenzhang@linux.microsoft.com>
---
The bug was found and this fix was developed with the assistance of an
LLM-based code analysis tool. The analysis, the patch and its testing
were reviewed and verified by the author.
drivers/connector/cn_proc.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 0056ab81fbc3..4f613c0648ae 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -421,6 +421,12 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
return;
}
+ if (mc_op != PROC_CN_MCAST_LISTEN &&
+ mc_op != PROC_CN_MCAST_IGNORE) {
+ err = EINVAL;
+ goto out;
+ }
+
ev_type = valid_event((enum proc_cn_event)ev_type);
if (ev_type == PROC_EVENT_NONE)
@@ -455,9 +461,6 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
((struct proc_input *)(sk->sk_user_data))->event_type =
PROC_EVENT_NONE;
break;
- default:
- err = EINVAL;
- break;
}
out:
--
2.55.0
Technical Details
Message-ID:
<20261102130922.75629-2-cenzhang@linux.microsoft.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354687-linux-kernel-netdev=dewy.ruReferences:
<20261102130922.75629-1-cenzhang@linux.microsoft.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354687-linux-kernel-netdev=dewy.ru
From: cenzhang@linux.microsoft.com ("Cen Zhang (Microsoft)")
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 1/2] connector/cn_proc: reject invalid mcast_op before touching socket state
Date: Mon, 2 Nov 2026 08:09:21 -0500
Organization: Usenet Network
Message-ID: <20261102130922.75629-2-cenzhang@linux.microsoft.com>
References: <20261102130922.75629-1-cenzhang@linux.microsoft.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2928642"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:zLs3Okw5gEbvP1CQEZp/GJNOuYc= sha256:13CUj6BBnlyk9D/2g4VjtkVSAj46l50wwg3OaxDfbqw=
sha1:TZMRUbyuIyLkMp3HblQP/ozwNbc= sha256:5eWC6LonOcgWP17Okxl2GptdYEIf48ChqjWRkdSrXqM=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id DA7BD112505; Mon, 2 Nov 2026 16:14:43 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
header.d=linux.microsoft.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id ngrrh-vDCe5J;
Mon, 2 Nov 2026 16:14:41 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-354687-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id 6C4AE1124E7; Mon, 2 Nov 2026 16:14:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sto.lore.kernel.org (Postfix) with ESMTP id 52E56609DDF; Mon, 2 Nov 2026 13:10:11 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail;
t=1793625002;
b=vfFlNq8Gnx9olxBTJSyKCCJL9XktYlziooNectPbZ+ai1Oe3DlffWxvGMC07xWvyT9U1
1sde34I7sKdm9QJJrdkdHVLJD90J+HFhnKOgQxZYOqOc+RS6nwq5xbTmofIu3AxF7tFqq
jkTlqocZmCoFe+nX2abgBdH/xA8OFHYCxhP0Bxvj1p/8hAv8WkbShLhEM1HrnmOqIfx3/
zKhB4SHL69sNsgSQgOTvrkXxz3tbCMChoJMt6sOoALKobQ+v2Plpfhd5uHsKEh7tEFedk
UrqNDsy39F9e4etvd0rbtA5vnhB1ZGIuSWxPJ/lEprLkrdxlvKxq6Wl7m3LKXBgugsQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793625002;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Filter:
DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
In-Reply-To:References:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=41nOmbxrN09tLyKUIJQ74F59C4mN14LzKcygeV3dkjA=;
b=u32beAeBi8I9F4fkU3Mbw/xNWRXJt/NSp2fjkM1Gi9gU3S0O1/0K8DcWZHeU7GE0vAJG
V47FR5Mm89JeCjRPkVbp2NSRzlQG3h4sXHLFFWQsR5uj0BRPoO7VQQksgYNS9ViS+SW8M
STb40lIjZjTC/Z7mXT5LShHYIDMF6+hM/tvlLkIsp7ZOECGBImP4KNofAUxezgLqGtUZm
xScPIsm9G4lTNIlnSSXVzwIBQHMsnYB3no7DHGNblZAc5q1TLjZsO878fJmfkAPa25hzu
2LbCpzP+SSvppug/80uV7AnvPaH0Nwwo/VlkHaVA5akOP7a/9e/hQbFyvRE+N6R7Cnw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=ahTVvF66;
dmarc=pass header.from=linux.microsoft.com;
spf=pass smtp.mailfrom=linux.microsoft.com;
arc=fail smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A8C4A606A33F;
Mon, 2 Nov 2026 13:10:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key, unprotected) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=ahTVvF66
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=13.77.154.182
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793624991;
b=TcnxXSDIc//Uq8UYiLkdwuUt/qpWBJidRobljuYA9YV1PDPasDj5O1/D21I0N0wre+67
rq3z83AyYt65R0hLxQ9RxL6RUeeYgSegSkgJFBGsqymIMjLQbk14TkSYCFQ7KtQBhvkLB
FuhHKpQ2fQ0huwjzQCkRFskh4jCCgS1ZlKmKiro8hzhgg9Mw2iqvOFsaKePrCQkTYRS9C
Pk51lsx+U8bLuMEs3BasRr0+f+DajmS5LsJnB9RJIISd8+MVrQN1gOf5xqDS3+A2Kmz8z
WxqXrMZ2jvtDPHgLFpu+8Jy/ADTWbVT7dxV9fuT+BHsEagrSGLyDiwHtzSixMQmSuCg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793624991;
h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:From:To:Cc:Subject:
Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding:X-Spam-Status:X-Spam-Checker-Version;
bh=41nOmbxrN09tLyKUIJQ74F59C4mN14LzKcygeV3dkjA=;
b=MM/35gz+pwLvzhQNYTTJ+8GYyQrGNQjOfw8sVNcZFGpdF7FAupD9cgjQ8jfsxFWTlnRY
IffzOarWoEKUj+y8SsBlSpbGIQ1wRERzDKuCL2cJjHRJP/Q8zno7A1xkrPZSWmzTWnAQS
juqGqg9bJZA2KzrJQkUiV4xY7/lA/H1zgjBPor5Kv9kyQTE4FNAL/jn8w6zGRx30WnAlB
1YlnAHT1+Mgzgl5vRVSQ8qnwmJ3mfJGtlTCeUamejYH6eSoykn/lfMVmxESobvTI/Ub10
6p118C4V1tRvzZxH+gheI2u7EDOXxaChzDme41ZzKofPXu70GEs1PM8cOlCHBYPDoog==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=linux.microsoft.com;
spf=pass smtp.mailfrom=linux.microsoft.com;
dkim=pass header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=ahTVvF66;
arc=none smtp.remote-ip=13.77.154.182
X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 71173606A329;
Mon, 2 Nov 2026 13:09:51 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 71173606A329
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com
X-Received: from mac.lan (unknown [52.172.102.253])
by linux.microsoft.com (Postfix) with ESMTPSA id 846B020B7168;
Mon, 2 Nov 2026 05:09:29 -0800 (PST)
X-DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 846B020B7168
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;
s=default; t=1793624976;
bh=41nOmbxrN09tLyKUIJQ74F59C4mN14LzKcygeV3dkjA=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=ahTVvF66k7WBCEetA92cNrJZLxG4My+YA5DgaWqTMFYxX/Eorw1hLXhZU4/elatRA
jvvgUTvLBxKEowZ8QcwCtwN28MSOqDeYxtMNAkO7flomEzitxahFHsG4I1RhyApQph
tQCaVtPs4HIjXLEynGEA/K8dS5ApG3M8B+3X9kcA=
X-Cc: Anjali Kulkarni <anjali.k.kulkarni@oracle.com>,
"Liam R. Howlett" <liam@infradead.org>,
netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
AutonomousCodeSecurity@microsoft.com,
tgopinath@linux.microsoft.com,
Cen Zhang <cenzhang@linux.microsoft.com>
X-Mailer: git-send-email 2.55.0
X-In-Reply-To: <20261102130922.75629-1-cenzhang@linux.microsoft.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list