mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 5.10 0/1] vdec_vp9_if: add check for NULL for vsi->frm_bufs[vsi->new_fb_idx].buf.fb in vp9_swap_frm_bufs
@ 2022-10-28 10:05 Anastasia Belova
  2022-10-28 10:05 ` [PATCH 5.10 1/1] " Anastasia Belova
  2022-10-28 10:34 ` [PATCH 5.10 0/1] " Greg Kroah-Hartman
  0 siblings, 2 replies; 4+ messages in thread
From: Anastasia Belova @ 2022-10-28 10:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Anastasia Belova, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Matthias Brugger, linux-media,
	linux-arm-kernel, linux-mediatek, linux-kernel, lvc-project

Null-pointer dereference was found with static analysis tools 
in version 5.10. Seems this file doesn't exist since 5.18.
This file was moved to 
    /drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c.
Maybe it is necessary to create another patch for these updates.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 5.10 1/1] vdec_vp9_if: add check for NULL for vsi->frm_bufs[vsi->new_fb_idx].buf.fb in vp9_swap_frm_bufs
  2022-10-28 10:05 [PATCH 5.10 0/1] vdec_vp9_if: add check for NULL for vsi->frm_bufs[vsi->new_fb_idx].buf.fb in vp9_swap_frm_bufs Anastasia Belova
@ 2022-10-28 10:05 ` Anastasia Belova
  2022-10-28 10:33   ` Greg Kroah-Hartman
  2022-10-28 10:34 ` [PATCH 5.10 0/1] " Greg Kroah-Hartman
  1 sibling, 1 reply; 4+ messages in thread
From: Anastasia Belova @ 2022-10-28 10:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Anastasia Belova, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Matthias Brugger, linux-media,
	linux-arm-kernel, linux-mediatek, linux-kernel, lvc-project

If vsi->frm_bufs[vsi->new_fb_idx].buf.fb == NULL while cleaning
fb_free_list NULL-pointer is dereferenced.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
---
 drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
index d9880210b2ab..dea056689b48 100644
--- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
+++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
@@ -512,7 +512,7 @@ static void vp9_swap_frm_bufs(struct vdec_vp9_inst *inst)
 	 * clean fb_free_list
 	 */
 	if (vsi->frm_bufs[vsi->new_fb_idx].ref_cnt == 0) {
-		if (!vp9_is_sf_ref_fb(
+		if (vsi->frm_bufs[vsi->new_fb_idx].buf.fb != NULL && !vp9_is_sf_ref_fb(
 			inst, vsi->frm_bufs[vsi->new_fb_idx].buf.fb)) {
 			struct vdec_fb *fb;
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5.10 1/1] vdec_vp9_if: add check for NULL for vsi->frm_bufs[vsi->new_fb_idx].buf.fb in vp9_swap_frm_bufs
  2022-10-28 10:05 ` [PATCH 5.10 1/1] " Anastasia Belova
@ 2022-10-28 10:33   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-10-28 10:33 UTC (permalink / raw)
  To: Anastasia Belova
  Cc: Tiffany Lin, Andrew-CT Chen, Mauro Carvalho Chehab,
	Matthias Brugger, linux-media, linux-arm-kernel, linux-mediatek,
	linux-kernel, lvc-project

On Fri, Oct 28, 2022 at 01:05:39PM +0300, Anastasia Belova wrote:
> If vsi->frm_bufs[vsi->new_fb_idx].buf.fb == NULL while cleaning
> fb_free_list NULL-pointer is dereferenced.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
> ---
>  drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
> index d9880210b2ab..dea056689b48 100644
> --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
> +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
> @@ -512,7 +512,7 @@ static void vp9_swap_frm_bufs(struct vdec_vp9_inst *inst)
>  	 * clean fb_free_list
>  	 */
>  	if (vsi->frm_bufs[vsi->new_fb_idx].ref_cnt == 0) {
> -		if (!vp9_is_sf_ref_fb(
> +		if (vsi->frm_bufs[vsi->new_fb_idx].buf.fb != NULL && !vp9_is_sf_ref_fb(
>  			inst, vsi->frm_bufs[vsi->new_fb_idx].buf.fb)) {
>  			struct vdec_fb *fb;
>  
> -- 
> 2.30.2
> 

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5.10 0/1] vdec_vp9_if: add check for NULL for vsi->frm_bufs[vsi->new_fb_idx].buf.fb in vp9_swap_frm_bufs
  2022-10-28 10:05 [PATCH 5.10 0/1] vdec_vp9_if: add check for NULL for vsi->frm_bufs[vsi->new_fb_idx].buf.fb in vp9_swap_frm_bufs Anastasia Belova
  2022-10-28 10:05 ` [PATCH 5.10 1/1] " Anastasia Belova
@ 2022-10-28 10:34 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-10-28 10:34 UTC (permalink / raw)
  To: Anastasia Belova
  Cc: Tiffany Lin, Andrew-CT Chen, Mauro Carvalho Chehab,
	Matthias Brugger, linux-media, linux-arm-kernel, linux-mediatek,
	linux-kernel, lvc-project

On Fri, Oct 28, 2022 at 01:05:38PM +0300, Anastasia Belova wrote:
> Null-pointer dereference was found with static analysis tools 
> in version 5.10. Seems this file doesn't exist since 5.18.
> This file was moved to 
>     /drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c.
> Maybe it is necessary to create another patch for these updates.

Fix this in Linus's tree first, and then worry about any potential need
for stable backports.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-28 10:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 10:05 [PATCH 5.10 0/1] vdec_vp9_if: add check for NULL for vsi->frm_bufs[vsi->new_fb_idx].buf.fb in vp9_swap_frm_bufs Anastasia Belova
2022-10-28 10:05 ` [PATCH 5.10 1/1] " Anastasia Belova
2022-10-28 10:33   ` Greg Kroah-Hartman
2022-10-28 10:34 ` [PATCH 5.10 0/1] " Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®