From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 4C3CE3BB687; Mon, 17 Aug 2026 14:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786975637; cv=none; b=CWmdAyt1YIiqlGTWbVcBfjWfKwKO233gQva4u6SDuQOu2D1z3LJWQSye5zrg0yaaToBJofhuIRJdK2+pp8DxS2ArISmBvxQ7nud/f2H3moo0EjruQ9H4VRxlZFGQzUd0X4oDWoftEpV6e/67aybqqdCAinxZZTF4KOQwB7b0ZyY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786975637; c=relaxed/simple; bh=MZ+YQstD9vgb/UDHP/zv1ZBKrYL6Jlx6c6dd/DMkvuc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XmPb0efftkZkmtyE2jHjX68f1ZJarF6VknugSS3T4/qjXh0qO5k8HwgbAn6qUj1k0/RwtAMW9R5/zgNFNKc1dj5DPZNKUhvUcy1ehHj/3+mW8fTMH63bk+OxEZZXm2K+9ZNm0r3tZCYlmJ0/fsCEjn3aIfaeW/1El7gXeVkRrlY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DrO+aQeg; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DrO+aQeg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9665C1F000E9; Mon, 17 Aug 2026 14:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786975636; bh=rSu4jRTz7mMa++qZfrR7/ltpismktM9EFTnVQOESlkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DrO+aQegvpzh6Ho1AOLohas2bUMX0eHQfZ8qIgIcndCHv6ikIPm/JpBLgL2A/O2xu ETuUG+/jIBvg244+Rr2ohQWCITbzhpZNiehLvQVAC5INotQgeRRFXfXamI3ogzRuNZ uljtTD8K/11DjS9kBkAC7kBuMkaEha8U17xy5il4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Aldo Ariel Panzardo , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 095/389] net: qrtr: restrict socket creation to the initial network namespace Date: Mon, 17 Aug 2026 15:28:54 +0200 Message-ID: <20260817132542.817327967@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132538.796021292@linuxfoundation.org> References: <20260817132538.796021292@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aldo Ariel Panzardo [ Upstream commit 3b536db8fb32da9e9c62f2bb45e2e319331f0426 ] QRTR keeps its entire port and node state in module-global variables that are not partitioned per network namespace: qrtr_local_nid is a single global node id (always 1) and qrtr_ports is a single global xarray. qrtr_port_lookup() and qrtr_local_enqueue() operate on that global state with no network-namespace check, and qrtr_create() places no restriction on the namespace a socket is created in. As a result an unprivileged process that creates an AF_QIPCRTR socket in a separate network namespace, e.g. via unshare(CLONE_NEWUSER | CLONE_NEWNET), can send QRTR datagrams - including control-plane messages such as QRTR_TYPE_NEW_SERVER - to QRTR sockets owned by another namespace, and vice versa. The receiving socket sees such a message as coming from node id 1, indistinguishable from a legitimate local client, breaking the isolation that network namespaces are expected to provide. QRTR is a transport to global hardware endpoints (the modem and other remote processors) and has no per-namespace semantics; its in-kernel name service already creates its socket in init_net only. Confine the socket family to the initial network namespace, as other non-namespace-aware socket families do (see llc_ui_create() and the ieee802154 socket code). Fixes: bdabad3e363d ("net: Add Qualcomm IPC router") Signed-off-by: Aldo Ariel Panzardo Link: https://patch.msgid.link/20260716154319.3297699-1-qwe.aldo@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/qrtr/af_qrtr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c index 0018a9b32241b9..31371f3c1a57b2 100644 --- a/net/qrtr/af_qrtr.c +++ b/net/qrtr/af_qrtr.c @@ -1257,6 +1257,14 @@ static int qrtr_create(struct net *net, struct socket *sock, if (sock->type != SOCK_DGRAM) return -EPROTOTYPE; + /* QRTR keeps its port and node state in module-global variables that + * are not partitioned per network namespace, and the in-kernel name + * service only operates in init_net. Confine the family to init_net so + * a socket in another namespace cannot reach the global control plane. + */ + if (!net_eq(net, &init_net)) + return -EAFNOSUPPORT; + sk = sk_alloc(net, AF_QIPCRTR, GFP_KERNEL, &qrtr_proto, kern); if (!sk) return -ENOMEM; -- 2.53.0