net/wan: fix a double free in x25_asy_open_tty()
commit0ca2635b418cdc1d47091a85f6f4bda46b8da264
authorCong Wang <xiyou.wangcong@gmail.com>
Sat, 29 Dec 2018 21:56:37 +0000 (29 13:56 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jan 2019 15:16:40 +0000 (9 16:16 +0100)
treee3cd5f9085026083593f2bdd566741ce86b5f762
parentaa9f3a0f2b5dd9b567d43f2a3ffe67aa0b667dff
net/wan: fix a double free in x25_asy_open_tty()

[ Upstream commit d5c7c745f254c6cb98b3b3f15fe789b8bd770c72 ]

When x25_asy_open() fails, it already cleans up by itself,
so its caller doesn't need to free the memory again.

It seems we still have to call x25_asy_free() to clear the SLF_INUSE
bit, so just set these pointers to NULL after kfree().

Reported-and-tested-by: syzbot+5e5e969e525129229052@syzkaller.appspotmail.com
Fixes: 3b780bed3138 ("x25_asy: Free x25_asy on x25_asy_open() failure.")
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wan/x25_asy.c