net: wan: Add checks for NULL for utdm in undo_uhdlc_init and unmap_si_regs

[ Upstream commit 488e0bf7f3 ]

If uhdlc_priv_tsa != 1 then utdm is not initialized.
And if ret != NULL then goto undo_uhdlc_init, where
utdm is dereferenced. Same if dev == NULL.

Found by Astra Linux on behalf of Linux Verification Center
(linuxtesting.org) with SVACE.

Fixes: 8d68100ab4 ("soc/fsl/qe: fix err handling of ucc_of_parse_tdm")
Signed-off-by: Esina Ekaterina <eesina@astralinux.ru>
Link: https://lore.kernel.org/r/20230112074703.13558-1-eesina@astralinux.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Esina Ekaterina 2023-01-12 10:47:03 +03:00 коммит произвёл Greg Kroah-Hartman
Родитель 7f129927fe
Коммит 95347e41ca
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -1241,9 +1241,11 @@ static int ucc_hdlc_probe(struct platform_device *pdev)
free_dev:
free_netdev(dev);
undo_uhdlc_init:
iounmap(utdm->siram);
if (utdm)
iounmap(utdm->siram);
unmap_si_regs:
iounmap(utdm->si_regs);
if (utdm)
iounmap(utdm->si_regs);
free_utdm:
if (uhdlc_priv->tsa)
kfree(utdm);