]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mxser: fix xmit_buf leak in activate when LSR == 0xff
authorJiri Slaby <jslaby@suse.cz>
Mon, 24 Jan 2022 07:14:24 +0000 (08:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:06:21 +0000 (14:06 +0200)
commit6c9041b2f90c0eace73106f22350e1d2c98f5edc
tree768c17999405f4e432de95dcfe320d21721612af
parentf3c006d3a4440a749bd3c38dd2c57442b005542a
mxser: fix xmit_buf leak in activate when LSR == 0xff

[ Upstream commit cd3a4907ee334b40d7aa880c7ab310b154fd5cd4 ]

When LSR is 0xff in ->activate() (rather unlike), we return an error.
Provided ->shutdown() is not called when ->activate() fails, nothing
actually frees the buffer in this case.

Fix this by properly freeing the buffer in a designated label. We jump
there also from the "!info->type" if now too.

Fixes: 6769140d3047 ("tty: mxser: use the tty_port_open method")
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220124071430.14907-6-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/mxser.c