media: vidtv: fix general protection fault in vidtv_psi_ts_psi_write_into
Subsystems (2)
PATCH v2 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.
--- 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
@@ -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
syzbotI 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_argspointers to avoid null pointer dereference reported by syzbot.Reported-by [email protected]Signed-off-by Soham Kute <[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@@ -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.
Hi Soham,
Quoted 4 lines · Soham Kute
Add defensive validation for
psi_write_argspointers to avoid null pointer dereference reported by syzbot.Reported-by [email protected]
I can't find any report with this hash from syzbot.
Can you point me to the correct syzbot report?
Quoted 11 lines
Signed-off-by Soham Kute <[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 +0
-0
drivers/media/test-drivers/vidtv/vidtv_psi.c static void vidtv_psi_set_sec_len(struct vidtv_psi_table_header *h, u16 new_len) · line 164
Quoted 10 lines
drivers/media/test-drivers/vidtv/vidtv_psi.c +6
-1@@ -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 ; + }
I'm fairly certain you paper over the real bug, which is somewhere else.
The question is where the NULL pointer is exactly and why it is NULL.
Without the syzbot report I have no idea.
Regards,
Hans
Quoted 4 lines
drivers/media/test-drivers/vidtv/vidtv_psi.c +1
-0+struct vidtv_mpeg_ts ts_header = { .sync_byte =TS_SYNC_BYTE , .bitfield =cpu_to_be16 ((args->new_psi_section <<14 ) | args->pid),