Re: vidioc_g_edid: BUG: Unable to handle kernel NULL pointer dereference at virtual address 00000716

From: Naresh Kamboju
Date: Tue Apr 30 2019 - 09:20:36 EST


Hi Hans,

On Tue, 30 Apr 2019 at 12:58, Hans Verkuil <hverkuil-cisco@xxxxxxxxx> wrote:
>
> On 4/30/19 9:10 AM, Naresh Kamboju wrote:
> > v4l2-compliance test running on linux stable 4.9 reported kernel bug.
> > The crash is pointing to kernel module "vivid.ko" which was loaded by
> > test case. ( modprobe vivid.ko)
> >
> >
>
> It's a CEC related bug, this vivid patch should fix it. It's a backport of
> commit ed356f110403 ("media: vivid: check if the cec_adapter is valid"). This
> commit was only backported to 4.12 and up since it didn't apply to older kernels.

I have tested this patch on x86_64 and confirms this works.
v4l2-compliance test runs to complete successfully.


>
> Feel free to post this patch (after testing!) to the stable mailinglist for
> inclusion into 4.9.

I will post this patch on stable mailing list.

>
> Regards,
>
> Hans
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
> ---
> --- a/drivers/media/platform/vivid/vivid-vid-common.c 2019-04-30 09:23:37.296797292 +0200
> +++ b/drivers/media/platform/vivid/vivid-vid-common.c 2019-04-30 09:24:09.581261759 +0200
> @@ -841,6 +841,7 @@
> if (edid->start_block + edid->blocks > dev->edid_blocks)
> edid->blocks = dev->edid_blocks - edid->start_block;
> memcpy(edid->edid, dev->edid, edid->blocks * 128);
> - cec_set_edid_phys_addr(edid->edid, edid->blocks * 128, adap->phys_addr);
> + if (adap)
> + cec_set_edid_phys_addr(edid->edid, edid->blocks * 128, adap->phys_addr);
> return 0;
> }


Best regards
Naresh Kamboju