video: hgafb: fix potential NULL pointer dereference
authorIgor Matheus Andrade Torrente <igormtorrente@gmail.com>
Mon, 3 May 2021 11:57:06 +0000 (13:57 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 May 2021 10:06:56 +0000 (12:06 +0200)
commit8e0d302e7e518cf6260db991aaee17da65fb25cf
tree5bf7d24c5b95516a4f1d9524f73b4e4a7a3fe9d0
parent98404acf0a20ca7dcbc4500d3e8d6edebd55024a
video: hgafb: fix potential NULL pointer dereference

commit dc13cac4862cc68ec74348a80b6942532b7735fa upstream.

The return of ioremap if not checked, and can lead to a NULL to be
assigned to hga_vram. Potentially leading to a NULL pointer
dereference.

The fix adds code to deal with this case in the error label and
changes how the hgafb_probe handles the return of hga_card_detect.

Cc: Ferenc Bakonyi <fero@drama.obuda.kando.hu>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
Link: https://lore.kernel.org/r/20210503115736.2104747-40-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/video/fbdev/hgafb.c