From: Colin Ian King Date: Fri, 17 Sep 2021 16:07:02 +0000 (+0200) Subject: media: em28xx: Don't use ops->suspend if it is NULL X-Git-Tag: v6.6.17~8751^2~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51fa3b70d27342baf1ea8aaab3e96e5f4f26d5b2;p=platform%2Fkernel%2Flinux-rpi.git media: em28xx: Don't use ops->suspend if it is NULL The call to ops->suspend for the dev->dev_next case can currently trigger a call on a null function pointer if ops->suspend is null. Skip over the use of function ops->suspend if it is null. Addresses-Coverity: ("Dereference after null check") Fixes: be7fd3c3a8c5 ("media: em28xx: Hauppauge DualHD second tuner functionality") Signed-off-by: Colin Ian King Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c index 584fa40..acc0bf7 100644 --- a/drivers/media/usb/em28xx/em28xx-core.c +++ b/drivers/media/usb/em28xx/em28xx-core.c @@ -1154,8 +1154,9 @@ int em28xx_suspend_extension(struct em28xx *dev) dev_info(&dev->intf->dev, "Suspending extensions\n"); mutex_lock(&em28xx_devlist_mutex); list_for_each_entry(ops, &em28xx_extension_devlist, next) { - if (ops->suspend) - ops->suspend(dev); + if (!ops->suspend) + continue; + ops->suspend(dev); if (dev->dev_next) ops->suspend(dev->dev_next); }