Skip to content

Commit

Permalink
media: em28xx: Don't use ops->suspend if it is NULL
Browse files Browse the repository at this point in the history
[ Upstream commit 51fa3b7 ]

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: be7fd3c ("media: em28xx: Hauppauge DualHD second tuner functionality")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Colin Ian King authored and gregkh committed Nov 17, 2021
1 parent 2b942c3 commit ee85728
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/media/usb/em28xx/em28xx-core.c
Expand Up @@ -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);
}
Expand Down

0 comments on commit ee85728

Please sign in to comment.