Skip to contentSkip to conversation

media: vidtv: fix general protection fault in vidtv_psi_ts_psi_write_into

PATCH Superseded Soham Kute 2 participants 3 messages Feb 7

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Soham Kute

author
#0 lore raw

PATCH 1/1 media: vidtv: fix general protection fault in vidtv_psi_ts_psi_write_into

Add defensive validation for psi_write_args pointers to avoid null pointer dereference reported by syzbot.

Reported-by [email protected]
---
 drivers/media/test-drivers/vidtv/vidtv_psi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/test-drivers/vidtv/vidtv_psi.c +7 -1
index 2a51c898c..bac0ea03b 100644
@@ -156,7 +156,13 @@ static void vidtv_psi_set_sec_len(struct vidtv_psi_table_header *h, u16 new_len)
  * add stuffing (i.e. padding bytes) after the CRC
  */
 static u32 vidtv_psi_ts_psi_write_into(struct psi_write_args *args)
-{
+{	
+	if (!args || !args->dest_buf || !args->from ||
+	    !args->continuity_counter) {
+		pr_warn_once("%s: invalid write arguments\n", __func__);
+		return 0;
+	}
+
 	struct vidtv_mpeg_ts ts_header = {
 		.sync_byte = TS_SYNC_BYTE,
 		.bitfield = cpu_to_be16((args->new_psi_section << 14) | args->pid),
Signature · 1 line
2.34.1
syzbot
#1 lore raw
I see the command but can't find the corresponding bug. The email is sent to [email protected] address but the HASH does not correspond to any known bug. Please double check the…
Quoted 32 lines

Add defensive validation for psi_write_args pointers to avoid null pointer dereference reported by syzbot.

Reported-by [email protected]
---
 drivers/media/test-drivers/vidtv/vidtv_psi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/test-drivers/vidtv/vidtv_psi.c +7 -1
index 2a51c898c..bac0ea03b 100644
@@ -156,7 +156,13 @@ static void vidtv_psi_set_sec_len(struct vidtv_psi_table_header *h, u16 new_len)
  * add stuffing (i.e. padding bytes) after the CRC
  */
 static u32 vidtv_psi_ts_psi_write_into(struct psi_write_args *args)
-{
+{	
+	if (!args || !args->dest_buf || !args->from ||
+	    !args->continuity_counter) {
+		pr_warn_once("%s: invalid write arguments\n", __func__);
+		return 0;
+	}
+
 	struct vidtv_mpeg_ts ts_header = {
 		.sync_byte = TS_SYNC_BYTE,
 		.bitfield = cpu_to_be16((args->new_psi_section << 14) | args->pid),
Signature · 1 line
2.34.1

I see the command but can't find the corresponding bug. The email is sent to [email protected] address but the HASH does not correspond to any known bug. Please double check the address.

author
#2 lore raw

v2: resend with correct syzbot Reported-by and maintainer To: list.

Quoted 32 lines · syzbot

Review

Quoted 11 lines

Add defensive validation for psi_write_args pointers to avoid null pointer dereference reported by syzbot.

Reported-by [email protected]
---
 drivers/media/test-drivers/vidtv/vidtv_psi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/media/test-drivers/vidtv/vidtv_psi.c

drivers/media/test-drivers/vidtv/vidtv_psi.c static void vidtv_psi_set_sec_len(struct

Quoted 4 lines

index 2a51c898c..bac0ea03b 100644

drivers/media/test-drivers/vidtv/vidtv_psi.c +0 -0
@@ -156,7 +156,13 @@ static void vidtv_psi_set_sec_len(struct

vidtv_psi_table_header *h, u16 new_len)

Quoted 4 lines
drivers/media/test-drivers/vidtv/vidtv_psi.c +0 -1
  * add stuffing (i.e. padding bytes) after the CRC
  */
 static u32 vidtv_psi_ts_psi_write_into(struct psi_write_args *args)
-{

drivers/media/test-drivers/vidtv/vidtv_psi.c static void vidtv_psi_set_sec_len(struct · line 168

Quoted 10 lines
drivers/media/test-drivers/vidtv/vidtv_psi.c +7 -0
+{
+     if (!args || !args->dest_buf || !args->from ||
+         !args->continuity_counter) {
+             pr_warn_once("%s: invalid write arguments\n", __func__);
+             return 0;
+     }
+
      struct vidtv_mpeg_ts ts_header = {
              .sync_byte = TS_SYNC_BYTE,
              .bitfield = cpu_to_be16((args->new_psi_section << 14) |

args->pid),

Quoted 10 lines
Quoted 3 lines

--
2.34.1

I see the command but can't find the corresponding bug. The email is sent to [email protected] address but the HASH does not correspond to any known bug. Please double check the address.

From fd746b95987239073f7872275cd68fe8cb29e0ed Mon Sep 17 00:00:00 2001
From: Soham Kute <[email protected]>
Date: Sun, 8 Feb 2026 01:43:40 +0530
Subject: [PATCH] [PATCH v2] media: vidtv: fix general protection fault in
vidtv_psi_ts_psi_write_into

Add defensive validation for psi_write_args pointers to avoid null pointer dereference reported by syzbot.

Reported-by [email protected]
---
 drivers/media/test-drivers/vidtv/vidtv_psi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/test-drivers/vidtv/vidtv_psi.c +7 -1
index 2a51c898c..bac0ea03b 100644
@@ -156,7 +156,13 @@ static void vidtv_psi_set_sec_len(struct vidtv_psi_table_header *h, u16 new_len)
  * add stuffing (i.e. padding bytes) after the CRC
  */
 static u32 vidtv_psi_ts_psi_write_into(struct psi_write_args *args)
-{
+{	
+	if (!args || !args->dest_buf || !args->from ||
+	    !args->continuity_counter) {
+		pr_warn_once("%s: invalid write arguments\n", __func__);
+		return 0;
+	}
+
 	struct vidtv_mpeg_ts ts_header = {
 		.sync_byte = TS_SYNC_BYTE,
 		.bitfield = cpu_to_be16((args->new_psi_section << 14) | args->pid),
Signature · 1 line
2.34.1