]> git.baikalelectronics.ru Git - kernel.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:23:43 +0000 (14:23 +0200)
commite060778eee7dd609a74c4f5193e21fbfc0150dab
tree2ad10cfb2865a44098d4abbe68e0c630b02c50b3
parentce34b3f1a160772250e974dc8ca085bb1beb5ff2
mxser: fix xmit_buf leak in activate when LSR == 0xff

[ Upstream commit afd08c25022267d1e8dcfc2b9b34b7e3e8f32bd4 ]

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: 47b7d8cfa6ab ("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