From patchwork Wed Jan 22 22:26:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 2037755 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=OQSpMgv/; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=hBK90ezi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Yddym41zrz20Hg for ; Thu, 23 Jan 2025 09:28:47 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hUVDjJ6tVklurCtWriG17hPaT+Jq13ibGOPUIqgphQ4=; b=OQSpMgv/rwxEyj 585qVjR5fiLC0eEuXOdoK8ZD4t2xJvOKeLO6Cq+Hh7plFKGGwV5F6iFSP4MlaS9KeoOfCI0JU35ZC PYyaCBjP/2vbKOy4ajK1hKvahF12eYWpWMM+uD6KzC9IByBD4OnY9X0pcmDeiMQEh545JkHrTjdsE pqRO64CJSDjehLuirDzYfR8RMckPCmDKHh+jFnQ1R+vBoqPvpiHYrhtAAzyK04+HM4NxiaE3EUr4C //o+FlFpCUhOUyxkioaxwuelAK/viZBi9CRv0i29ltlEWOC9UjA6Xo3MHxqjtbS1tcePDyPXGHYyg zPdUkxC8Uq4Etwl05KmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tajBt-0000000BJOe-104a; Wed, 22 Jan 2025 22:27:17 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tajBq-0000000BJLo-2TIC for openwrt-devel@lists.openwrt.org; Wed, 22 Jan 2025 22:27:15 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-386329da1d9so108200f8f.1 for ; Wed, 22 Jan 2025 14:27:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737584833; x=1738189633; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4CGIX+1yjTWIBnKwZ2y5X/bgTwnEo140X9euQCutdUE=; b=hBK90eziechfe+5GgK+l8ORrQioNAR4cU0drZ6gQwzBqXi2rql2Yl8dMk+wnmvaqaw sDOGffAWmohO5xD9U8exsm2qbaJg66bxllPmcqLj93ZkLHsvPoR6QRhPkOAmAhCM2X8J K+CB8JlD4G6b8gHjYOcsVZmYRf6NYXC5gQzZoamUMG58nY+p59ltZBkRh1yIMq5QzWlX 9Y+c5ds/tCSu5HMdEDCEUHA5t3OzTU3nM1DWIvRXey8dnHG6FoXaTh3rSXmqQHrpONxA oymeoahFos0FKqADvWUuqkO04xYNGrL6BkGjbdjH+PDy8sK31SKpYvB+XKaCd/Ed8ZfJ RzsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737584833; x=1738189633; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4CGIX+1yjTWIBnKwZ2y5X/bgTwnEo140X9euQCutdUE=; b=WlN7cTWDVBCwVZNmCnZig5Whpox79tP94tsxQzPfAXwle1jwSJHgTkUVhL1AbxWNyt TDWn9eWwNC7/2gBvd3dwPagp2QoKEJl1Lf0xqy8ivJ51xHsPSD8msRXXk6KOykmh+uPi b1TxKVM9o6oxyaOzfvBp5RqvrgTfeSY6WGF9gvB+Ht9+A9ROgUUcdKEV0KZMB4wluSNu LpIMeRYvw502P5wfUB1WxGVpFP8hkjtMfO4YmcXtJ7BWT7h4TE7H/5QZ6lq4M16FS5iN o04da75opxtf4S9HsNqTdTwExdflbWtyef9u//GaiiHZZICCDv3gYIBHy0+zumwwvrQr r/VA== X-Gm-Message-State: AOJu0YxgQB3qXG25f7kfuz+yF+6zIo7fAorC25TsqolxmZ0w3qEMJp/l 1/3n9hlwdATdQ29SdnFUjOSvPthYbhRYCt+8pdEDZjDXFollCrKN X-Gm-Gg: ASbGncsbXFDlFEYfYwnWbtXwiY/iO9tt2ZzGzLr7vZUlucZyC/zmbxf1NG2XEvUv4xb OGuV0fNVgIoxUFtsCQ0TLhUVQiK6S5E41xpEWMexPFlBUkDiZxZntxXOENM0tUhcPTFSbCVaO9i cbMi7gMtS52TDzRV1aQ4TPkIoj43dGDPpsQ8r/BMzc2Lhe6EjCWfBw5wZ6BsBRO0AAEXJVguYlo ZJDaQCxq/9V7VTW7Hu3dBmrb1R2/Ds4YplQrap5V22JJwa1Pi0hSqDLlDpsL3Q63nIH6t10UVz2 KYSj4g== X-Google-Smtp-Source: AGHT+IFEmhRihgiaxDKNrloWbLGYXKqMOtKwdbhErFYb5ojs+YiKgcY1XMc7j9yLwV9/kv8cdZ7dMg== X-Received: by 2002:a05:6000:e4a:b0:385:ed16:c91 with SMTP id ffacd0b85a97d-38bf566f3bemr17101611f8f.24.1737584832857; Wed, 22 Jan 2025 14:27:12 -0800 (PST) Received: from localhost.localdomain ([69.6.8.124]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf328864esm17773125f8f.99.2025.01.22.14.27.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 14:27:12 -0800 (PST) From: Sergey Ryazanov To: Daniel Golle Cc: OpenWrt Development List , Andre Heider , Hauke Mehrtens , Jan Hoffmann , Martin Schiller Subject: [PATCH v4 2/4] kernel: vrx518_tc: fix ADSL/ATM operation Date: Thu, 23 Jan 2025 00:26:52 +0200 Message-ID: <20250122222654.21833-3-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250122222654.21833-1-ryazanov.s.a@gmail.com> References: <20250122222654.21833-1-ryazanov.s.a@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250122_142714_627225_BDF1A7FD X-CRM114-Status: GOOD ( 19.04 ) X-Spam-Score: -1.1 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: ATM TC layer have some issues which effectively prevent VRX518 from being used as ADSL modem. Specifically, there one crash during the ATM layer configuration and wrong PVC ID selection on packet rece [...] Content analysis details: (-1.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:42f listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ryazanov.s.a(at)gmail.com] 1.0 FREEMAIL_REPLY From and body contain different freemails X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org ATM TC layer have some issues which effectively prevent VRX518 from being used as ADSL modem. Specifically, there one crash during the ATM layer configuration and wrong PVC ID selection on packet receiving what breaks RX path. Fix both of the issues. Make subif iface registration optional to prevent the crash (see more details in the new patch) and update the hardcoded PVC ID to match the first allocated channel. Run tested with FRITZ!Box 7530. Fixes: 474bbe23b7 ("kernel: add Intel/Lantiq VRX518 TC driver") Reported-and-tested-by: nebibigon93@yandex.ru Signed-off-by: Sergey Ryazanov --- .../lantiq/vrx518_tc/patches/100-compat.patch | 2 +- ...tm_tc-fix-crash-on-subif_reg-absence.patch | 75 +++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch diff --git a/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch b/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch index d04c1ed5df..81e32369ba 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch @@ -166,7 +166,7 @@ - return (skb->DW0 >> 3) & 0xF; +// return (skb->DW0 >> 3) & 0xF; -+ return 1; ++ return 0; /* We use only one connection for now, so return the first connection id */ } static int atm_get_qid_by_vcc(struct net_device *dev, struct sk_buff *skb, diff --git a/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch b/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch new file mode 100644 index 0000000000..87456424c3 --- /dev/null +++ b/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch @@ -0,0 +1,75 @@ +From: Sergey Ryazanov +Date: Fri, 10 Jan 2025 00:57:27 +0000 +Subject: [PATCH] vrx518_tc: atm_tc: fix crash on subif_reg absence + +VRX518 (sw_plat) platform does not provid the subif_reg/subif_unreg ops +in the same time ATM TC layer unconditionally calls them, what leads to +the kernel crash on the atm_hook_mpoa_setup hook invocation from the ATM +stack: + + vrx518_tc:mpoa_setup_sync : sync: conn: 0, vpi: 0, vci: 35, mpoa_type: 0, mpoa_mode: 0 + Unable to handle kernel NULL pointer dereference at virtual address 00000000 + +Subif registration is optional and PTM TC do this only when the +corresponding ops are defined. Do the same for ATM TC and call +subif_reg/subif_unreg only if they are not NULL. + +While at it, move subif related data preparation under the 'if' block +in order to group and isolate that aux code. + +Run tested with FRITZ!Box 7530. + +Signed-off-by: Sergey Ryazanov +--- +--- a/dcdp/atm_tc.c ++++ b/dcdp/atm_tc.c +@@ -1232,8 +1232,9 @@ static void ppe_close(struct atm_vcc *vc + validate_oam_htu_entry(priv, 0); + spin_unlock_bh(&priv->atm_lock); + +- priv->tc_priv->tc_ops.subif_unreg(dev, (!dev) ? dev_name : dev->name, +- priv->conn[cid].subif_id, 0); ++ if (priv->tc_priv->tc_ops.subif_unreg) ++ priv->tc_priv->tc_ops.subif_unreg(dev, (!dev) ? dev_name : dev->name, ++ priv->conn[cid].subif_id, 0); + + memset(conn, 0, sizeof(*conn)); + +@@ -2791,24 +2792,26 @@ static void mpoa_setup_sync(struct atm_p + struct wtx_queue_config_t tx_qcfg; + struct uni_cell_header *cell_header; + struct atm_vcc *vcc; +- struct net_device *dev; +- char dev_name[32]; + + tc_dbg(priv->tc_priv, MSG_INIT, + "sync: conn: %d, vpi: %d, vci: %d, mpoa_type: %d, mpoa_mode: %d\n", + conn, priv->conn[conn].vcc->vpi, priv->conn[conn].vcc->vci, + priv->conn[conn].mpoa_type, priv->conn[conn].mpoa_mode); + +- dev = priv->conn[conn].dev; ++ if (priv->tc_priv->tc_ops.subif_reg) { ++ struct net_device *dev; ++ char dev_name[32]; ++ ++ dev = priv->conn[conn].dev; ++ if (!dev) ++ sprintf(dev_name, "atm_%d%d", ++ priv->conn[conn].vcc->vpi, priv->conn[conn].vcc->vci); + +- if (!dev) +- sprintf(dev_name, "atm_%d%d", +- priv->conn[conn].vcc->vpi, priv->conn[conn].vcc->vci); +- +- priv->tc_priv->tc_ops.subif_reg(dev, (!dev) ? dev_name : dev->name, +- &priv->conn[conn].subif_id, 0); +- tc_dbg(priv->tc_priv, MSG_INIT, +- "conn[%d]subif_id[%x]", conn, priv->conn[conn].subif_id); ++ priv->tc_priv->tc_ops.subif_reg(dev, !dev ? dev_name : dev->name, ++ &priv->conn[conn].subif_id, 0); ++ tc_dbg(priv->tc_priv, MSG_INIT, ++ "conn[%d]subif_id[%x]", conn, priv->conn[conn].subif_id); ++ } + vcc = priv->conn[conn].vcc; + + /* set htu entry */