* [PATCH] media: em28xx: Don't use ops->resume if NULL
@ 2018-04-23 11:02 Mauro Carvalho Chehab
2018-04-24 10:08 ` Sakari Ailus
0 siblings, 1 reply; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2018-04-23 11:02 UTC (permalink / raw)
Cc: Mauro Carvalho Chehab, Linux Media Mailing List, Mauro Carvalho Chehab
Changeset be7fd3c3a8c5 ("media: em28xx: Hauppauge DualHD
second tuner functionality") introduced a potential NULL pointer
dereference, as pointed by Coverity:
CID 1434731 (#1 of 1): Dereference after null check (FORWARD_NULL)16. var_deref_op: Dereferencing null pointer ops->resume.
var_compare_op: Comparing ops->resume to null implies that ops->resume might be null.
1174 if (ops->resume)
1175 ops->resume(dev);
1176 if (dev->dev_next)
1177 ops->resume(dev->dev_next);
Fixes: be7fd3c3a8c5 ("media: em28xx: Hauppauge DualHD second tuner functionality")
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
drivers/media/usb/em28xx/em28xx-core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 36d341fb65dd..0cefd29184f6 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -1171,8 +1171,9 @@ int em28xx_resume_extension(struct em28xx *dev)
dev_info(&dev->intf->dev, "Resuming extensions\n");
mutex_lock(&em28xx_devlist_mutex);
list_for_each_entry(ops, &em28xx_extension_devlist, next) {
- if (ops->resume)
- ops->resume(dev);
+ if (!ops->resume)
+ continue;
+ ops->resume(dev);
if (dev->dev_next)
ops->resume(dev->dev_next);
}
--
2.14.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: em28xx: Don't use ops->resume if NULL
2018-04-23 11:02 [PATCH] media: em28xx: Don't use ops->resume if NULL Mauro Carvalho Chehab
@ 2018-04-24 10:08 ` Sakari Ailus
0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2018-04-24 10:08 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab
On Mon, Apr 23, 2018 at 07:02:39AM -0400, Mauro Carvalho Chehab wrote:
> Changeset be7fd3c3a8c5 ("media: em28xx: Hauppauge DualHD
> second tuner functionality") introduced a potential NULL pointer
> dereference, as pointed by Coverity:
>
> CID 1434731 (#1 of 1): Dereference after null check (FORWARD_NULL)16. var_deref_op: Dereferencing null pointer ops->resume.
>
> var_compare_op: Comparing ops->resume to null implies that ops->resume might be null.
> 1174 if (ops->resume)
> 1175 ops->resume(dev);
> 1176 if (dev->dev_next)
> 1177 ops->resume(dev->dev_next);
>
> Fixes: be7fd3c3a8c5 ("media: em28xx: Hauppauge DualHD second tuner functionality")
> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
--
Sakari Ailus
e-mail: sakari.ailus@iki.fi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-24 10:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 11:02 [PATCH] media: em28xx: Don't use ops->resume if NULL Mauro Carvalho Chehab
2018-04-24 10:08 ` Sakari Ailus
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.