Re: [PATCH] staging: media: omap4iss: add check for media_pad_remote_pad_first

From: Greg KH
Date: Fri Jul 26 2024 - 03:50:01 EST


On Fri, Jul 26, 2024 at 03:28:14PM +0800, Chen Ni wrote:
> Add check for the return value of media_pad_remote_pad_first() and
> return the error if it fails in order to avoid NULL pointer dereference.
>
> Fixes: b2e44430b634 ("media: mc-entity: Rename media_entity_remote_pad() to media_pad_remote_pad_first()")
> Signed-off-by: Chen Ni <nichen@xxxxxxxxxxx>
> ---
> drivers/staging/media/omap4iss/iss_csi2.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c
> index 0e6c5bd81930..43851bbd0cc3 100644
> --- a/drivers/staging/media/omap4iss/iss_csi2.c
> +++ b/drivers/staging/media/omap4iss/iss_csi2.c
> @@ -539,6 +539,9 @@ static int csi2_configure(struct iss_csi2_device *csi2)
> return -EBUSY;
>
> pad = media_pad_remote_pad_first(&csi2->pads[CSI2_PAD_SINK]);
> + if (!pad)
> + return -EPIPE;

How was this found and tested?

thanks,

greg k-h