]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
media: isif: fix a NULL pointer dereference bug
authorWenwen Wang <wang6495@umn.edu>
Thu, 4 Oct 2018 15:44:02 +0000 (11:44 -0400)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 28 Nov 2019 04:59:27 +0000 (23:59 -0500)
commitd5f8aea77a3c3a75c8330adacf03373805c38321
treee0e6c506a128ab9c2219cc638b0a63693d0a1599
parent1b28a1373ba61885fe1ec8218f2e9744f4b64e66
media: isif: fix a NULL pointer dereference bug

BugLink: https://bugs.launchpad.net/bugs/1854216
[ Upstream commit a26ac6c1bed951b2066cc4b2257facd919e35c0b ]

In isif_probe(), there is a while loop to get the ISIF base address and
linearization table0 and table1 address. In the loop body, the function
platform_get_resource() is called to get the resource. If
platform_get_resource() returns NULL, the loop is terminated and the
execution goes to 'fail_nobase_res'. Suppose the loop is terminated at the
first iteration because platform_get_resource() returns NULL and the
execution goes to 'fail_nobase_res'. Given that there is another while loop
at 'fail_nobase_res' and i equals to 0, one iteration of the second while
loop will be executed. However, the second while loop does not check the
return value of platform_get_resource(). This can cause a NULL pointer
dereference bug if the return value is a NULL pointer.

This patch avoids the above issue by adding a check in the second while
loop after the call to platform_get_resource().

Signed-off-by: Wenwen Wang <wang6495@umn.edu>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/media/platform/davinci/isif.c