Skip to contentSkip to conversation

interconnect: mediatek: fix Makefile typo for mt8196

PATCH Superseded Breno Rodrigues Alves 2 participants 6 messages Sep 5

Subsystems (11)
Media (V4L/DVB) USB Sound Staging +7 more subsystems

v8 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

PATCH v8 1/3 interconnect: mediatek: fix Makefile typo for mt8196

Correct a copy-paste typo in the MediaTek interconnect Makefile that mapped mt8196.o to CONFIG_INTERCONNECT_MTK_MT8195 instead of MT8196.

Assisted-by OpenCode AI
---
 drivers/interconnect/mediatek/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/interconnect/mediatek/Makefile +1 -1
index 6bd656668..64170ab16 100644
@@ -3,4 +3,4 @@
 obj-$(CONFIG_INTERCONNECT_MTK_DVFSRC_EMI) += icc-emi.o
 obj-$(CONFIG_INTERCONNECT_MTK_MT8183) += mt8183.o
 obj-$(CONFIG_INTERCONNECT_MTK_MT8195) += mt8195.o
-obj-$(CONFIG_INTERCONNECT_MTK_MT8195) += mt8196.o
+obj-$(CONFIG_INTERCONNECT_MTK_MT8196) += mt8196.o
Signature · 1 line
2.43.0
#1 lore raw

PATCH v8 2/3 regulator: mtk-spmi: fix Makefile typo for mt6316

Fix a Makefile typo that incorrectly placed the mt6316-regulator object under the old CONFIG_REGULATOR_MT6315 configuration flag.

Assisted-by OpenCode AI
---
 drivers/regulator/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/Makefile +1 -1
index 5a764cec8..f81d1f31a 100644
@@ -107,7 +107,7 @@ obj-$(CONFIG_REGULATOR_MP886X) += mp886x.o
 obj-$(CONFIG_REGULATOR_MPQ7920) += mpq7920.o
 obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o
 obj-$(CONFIG_REGULATOR_MT6315) += mt6315-regulator.o
-obj-$(CONFIG_REGULATOR_MT6315)  += mt6316-regulator.o
+obj-$(CONFIG_REGULATOR_MT6316)  += mt6316-regulator.o
 obj-$(CONFIG_REGULATOR_MT6323)	+= mt6323-regulator.o
 obj-$(CONFIG_REGULATOR_MT6331)	+= mt6331-regulator.o
 obj-$(CONFIG_REGULATOR_MT6332)	+= mt6332-regulator.o
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v8 2/3] regulator: mtk-spmi: fix Makefile typo for mt6316

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines

Fix a Makefile typo that incorrectly placed the mt6316-regulator object under the old CONFIG_REGULATOR_MT6315 configuration flag.

Assisted-by OpenCode AI

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#3 lore raw

PATCH v8 3/3 media: dvb-core: extirpate defective and unsafe ULE debug block

In reply to Breno Rodrigues Alves

Completely purge the unmaintained DVB_ULE_DEBUG code block from dvb_net.c and its Kconfig definition to eliminate severe lockless race conditions and clean up unused function parameters.

Assisted-by OpenCode AI
---
 drivers/media/dvb-core/Kconfig   | 11 ---------
 drivers/media/dvb-core/dvb_net.c | 40 --------------------------------
 2 files changed, 51 deletions(-)
drivers/media/dvb-core/Kconfig +0 -11
index 8b3f2d53c..c6a97add8 100644
@@ -67,14 +67,3 @@ config DVB_DEMUX_SECTION_LOSS_LOG
 
 	  If you are unsure about this, say N here.
 
-config DVB_ULE_DEBUG
-	bool "Enable DVB net ULE packet debug messages"
-	depends on DVB_CORE
-	help
-	  Enable extra log messages meant to detect problems while
-	  handling DVB network ULE packet loss inside the Kernel.
-
-	  Should not be enabled on normal cases, as logs can
-	  be very verbose.
-
-	  If you are unsure about this, say N here.
drivers/media/dvb-core/dvb_net.c +0 -40
index a2159b2bc..ae0073b94 100644
@@ -68,19 +68,6 @@ static inline __u32 iov_crc32( __u32 c, struct kvec *iov, unsigned int cnt )
 
 #define DVB_NET_MULTICAST_MAX 10
 
-#ifdef DVB_ULE_DEBUG
-/*
- * The code inside DVB_ULE_DEBUG keeps a history of the
- * last 100 TS cells processed.
- */
-static unsigned char ule_hist[100*TS_SZ] = { 0 };
-static unsigned char *ule_where = ule_hist, ule_dump;
-
-static void hexdump(const unsigned char *buf, unsigned short len)
-{
-	print_hex_dump_debug("", DUMP_PREFIX_OFFSET, 16, 1, buf, len, true);
-}
-#endif
 
 struct dvb_net_priv {
 	int in_use;
@@ -320,16 +307,6 @@ static int dvb_net_ule_new_ts_cell(struct dvb_net_ule_handle *h)
 {
 	/* We are about to process a new TS cell. */
 
-#ifdef DVB_ULE_DEBUG
-	if (ule_where >= &ule_hist[100*TS_SZ])
-		ule_where = ule_hist;
-	memcpy(ule_where, h->ts, TS_SZ);
-	if (ule_dump) {
-		hexdump(ule_where, TS_SZ);
-		ule_dump = 0;
-	}
-	ule_where += TS_SZ;
-#endif
 
 	/*
 	 * Check TS h->error conditions: sync_byte, transport_error_indicator,
@@ -659,23 +636,6 @@ static void dvb_net_ule_check_crc(struct dvb_net_ule_handle *h,
 			h->ts_remain > 2 ?
 				*(unsigned short *)h->from_where : 0);
 
-	#ifdef DVB_ULE_DEBUG
-		hexdump(iov[0].iov_base, iov[0].iov_len);
-		hexdump(iov[1].iov_base, iov[1].iov_len);
-		hexdump(iov[2].iov_base, iov[2].iov_len);
-
-		if (ule_where == ule_hist) {
-			hexdump(&ule_hist[98*TS_SZ], TS_SZ);
-			hexdump(&ule_hist[99*TS_SZ], TS_SZ);
-		} else if (ule_where == &ule_hist[TS_SZ]) {
-			hexdump(&ule_hist[99*TS_SZ], TS_SZ);
-			hexdump(ule_hist, TS_SZ);
-		} else {
-			hexdump(ule_where - TS_SZ - TS_SZ, TS_SZ);
-			hexdump(ule_where - TS_SZ, TS_SZ);
-		}
-		ule_dump = 1;
-	#endif
 
 		h->dev->stats.rx_errors++;
 		h->dev->stats.rx_crc_errors++;
Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH v8 3/3] media: dvb-core: extirpate defective and unsafe ULE debug block

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Low] The commit message explicitly claims to 'clean up unused function parameters', but the iov parameter in dvb_net_ule_check_crc() is left intact and completely unused.

Pre-existing issues:
- [Critical] Insufficient length checks during ULE decapsulation allow out-of-bounds reads from kernel memory, leading to an information leak and potential kernel crash. --

commit bc7f64f0594cb54302cffa558b837ac23e377b2e
Author: Breno Rodrigues Alves <[email protected]>

media: dvb-core: extirpate defective and unsafe ULE debug block

This patch removes the unmaintained DVB_ULE_DEBUG code block from the dvb-core network code, cleaning up its Kconfig definition and logging logic. It also claims to clean up unused function parameters.

Quoted 3 lines

Completely purge the unmaintained DVB_ULE_DEBUG code block from dvb_net.c and its Kconfig definition to eliminate severe lockless race conditions and clean up unused function parameters.

[Severity: Low]
The commit message claims to "clean up unused function parameters", but is the iov parameter still present and completely unused in dvb_net_ule_check_crc() after this removal?

It appears the caller in dvb_net_ule() still initializes and passes iov:

	struct kvec iov[3] = {
		{ &ulen, sizeof ulen },
		{ &utype, sizeof utype },
		{ h.priv->ule_skb->data,
		  h.priv->ule_skb->len - 4 }
	};
	...
	dvb_net_ule_check_crc(&h, iov, ule_crc, expected_crc);

Should iov be removed from the function signature and the caller as well?

Quoted 4 lines
drivers/media/dvb-core/dvb_net.c +0 -0
index a2159b2bc1766..ae0073b949a50 100644

[ ... ]

Quoted 14 lines
drivers/media/dvb-core/dvb_net.c +0 -10
@@ -659,23 +636,6 @@ static void dvb_net_ule_check_crc(struct dvb_net_ule_handle *h,
 			h->ts_remain > 2 ?
 				*(unsigned short *)h->from_where : 0);
 
-	#ifdef DVB_ULE_DEBUG
-		hexdump(iov[0].iov_base, iov[0].iov_len);
-		hexdump(iov[1].iov_base, iov[1].iov_len);
-		hexdump(iov[2].iov_base, iov[2].iov_len);
-
-		if (ule_where == ule_hist) {
-			hexdump(&ule_hist[98*TS_SZ], TS_SZ);
-			hexdump(&ule_hist[99*TS_SZ], TS_SZ);
-		} else if (ule_where == &ule_hist[TS_SZ]) {
-			hexdump(&ule_hist[99*TS_SZ], TS_SZ);

drivers/media/dvb-core/dvb_net.c static void dvb_net_ule_check_crc(struct dvb_net_ule_handle *h, · line 641

Quoted 10 lines
drivers/media/dvb-core/dvb_net.c +0 -7
-			hexdump(ule_hist, TS_SZ);
-		} else {
-			hexdump(ule_where - TS_SZ - TS_SZ, TS_SZ);
-			hexdump(ule_where - TS_SZ, TS_SZ);
-		}
-		ule_dump = 1;
-	#endif
 
 		h->dev->stats.rx_errors++;
 		h->dev->stats.rx_crc_errors++;

[Severity: Critical]
This is a pre-existing issue, but does this code properly check boundaries before pulling from the SKB?

Further down in dvb_net_ule_check_crc(), we blindly copy and pull ETH_ALEN:

	skb_copy_from_linear_data(h->priv->ule_skb, dest_addr, ETH_ALEN);
	skb_pull(h->priv->ule_skb, ETH_ALEN);

If skb->len is very small (e.g., ule_sndu_len < 10), skb_pull() fails silently, leaving the data pointer unadvanced.

Later, handle_one_ule_extension() blindly advances the header pointer by hlen << 1 without bounds checking:

	ext_len = hlen << 1;
	if (ule_optional_ext_handlers[htype])
		(void)ule_optional_ext_handlers[htype]( p );
	p->ule_next_hdr += ext_len;
	p->ule_sndu_type = ntohs( *(__be16 *)(p->ule_next_hdr-2) );

Can this sequence lead to an out-of-bounds slab read if an attacker broadcasts a malformed DVB transport stream cell with extension headers indicating a large length?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#5 lore raw
In reply to Breno Rodrigues Alves
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines

Correct a copy-paste typo in the MediaTek interconnect Makefile that mapped mt8196.o to CONFIG_INTERCONNECT_MTK_MT8195 instead of MT8196.

Assisted-by OpenCode AI

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1