Commit 9b7736dd authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by openeuler-sync-bot
Browse files

serial: 8250: omap: Don't skip resource freeing if pm_runtime_resume_and_get() failed

stable inclusion
from stable-v5.10.209
commit bc57f3ef8a9eb0180606696f586a6dcfaa175ed0
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I93EDC
CVE: CVE-2023-52457

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=bc57f3ef8a9eb0180606696f586a6dcfaa175ed0



--------------------------------

[ Upstream commit ad90d0358bd3b4554f243a425168fc7cebe7d04e ]

Returning an error code from .remove() makes the driver core emit the
little helpful error message:

	remove callback returned a non-zero value. This will be ignored.

and then remove the device anyhow. So all resources that were not freed
are leaked in this case. Skipping serial8250_unregister_port() has the
potential to keep enough of the UART around to trigger a use-after-free.

So replace the error return (and with it the little helpful error
message) by a more useful error message and continue to cleanup.

Fixes: e3f0c638 ("serial: 8250: omap: Fix unpaired pm_runtime_put_sync() in omap8250_remove()")
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarTony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20231110152927.70601-2-u.kleine-koenig@pengutronix.de


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Conflicts:
	drivers/tty/serial/8250/8250_omap.c
Signed-off-by: default avatarGUO Zihua <guozihua@huawei.com>
(cherry picked from commit 9d7ade39)
parent 2ee7a240
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment