From: "wanquan.zhong" Add a new Kconfig option for MediaTek T7xx WWAN devices, to conditionally enable the ADB debug port functionality. This option: - Depends on MTK_T7XX (specific to MediaTek T7xx devices) - Defaults to 'y', as disabling it may cause difficulties for T7xx debugging - Requires EXPERT to be visible (to avoid accidental enablement) In t7xx_port_proxy.c, wrap the ADB port configuration struct with CONFIG_WWAN_ADB_PORT, so the port is only exposed when the config is explicitly enabled. This addresses security concerns in certain systems (e.g., Google Chrome OS)where root privileges could potentially trigger ADB configuration of WWAN devices.Note that only ADB port is restricted while MIPC port remains unrestricted,as MIPC is MTK's internal protocol port with no security risks. While using a kernel config option for a single array element in t7xx may seem like resource overhead, this is the most straightforward implementation approach. Alternative implementation suggestions are welcome. Signed-off-by: wanquan.zhong --- drivers/net/wwan/Kconfig | 12 ++++++++++++ drivers/net/wwan/t7xx/t7xx_port_proxy.c | 2 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/net/wwan/Kconfig b/drivers/net/wwan/Kconfig index 410b0245114e..ef36a49cc85c 100644 --- a/drivers/net/wwan/Kconfig +++ b/drivers/net/wwan/Kconfig @@ -26,6 +26,18 @@ config WWAN_DEBUGFS If this option is selected, then you can find the debug interface elements for each WWAN device in a directory that is corresponding to the device name: debugfs/wwan/wwanX. +config WWAN_ADB_PORT + bool "MediaTek T7xx ADB port support" if EXPERT + depends on MTK_T7XX + default y + help + Enables ADB (Android Debug Bridge) debug port support for MediaTek T7xx WWAN devices. + + This option enables the ADB debug port functionality in the MediaTek T7xx driver, + allowing Android Debug Bridge connections through T7xx modems that support + this feature. It is primarily used for debugging and development purposes. + + If unsure, say Y. config WWAN_HWSIM tristate "Simulated WWAN device" diff --git a/drivers/net/wwan/t7xx/t7xx_port_proxy.c b/drivers/net/wwan/t7xx/t7xx_port_proxy.c index 4fc131f9632f..9f3b7b1dd4e2 100644 --- a/drivers/net/wwan/t7xx/t7xx_port_proxy.c +++ b/drivers/net/wwan/t7xx/t7xx_port_proxy.c @@ -102,6 +102,7 @@ static const struct t7xx_port_conf t7xx_port_conf[] = { .ops = &ctl_port_ops, .name = "t7xx_ap_ctrl", }, { +#ifdef CONFIG_WWAN_ADB_PORT .tx_ch = PORT_CH_AP_ADB_TX, .rx_ch = PORT_CH_AP_ADB_RX, .txq_index = Q_IDX_ADB, @@ -112,6 +113,7 @@ static const struct t7xx_port_conf t7xx_port_conf[] = { .port_type = WWAN_PORT_ADB, .debug = true, }, { +#endif .tx_ch = PORT_CH_MIPC_TX, .rx_ch = PORT_CH_MIPC_RX, .txq_index = Q_IDX_MBIM_MIPC, -- 2.43.0