提交 e8d5ac4b 编写于 作者: C Cong Wang 提交者: Xie XiuQi

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: 3b780bed ("x25_asy: Free x25_asy on x25_asy_open() failure.")
Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 3670c297
...@@ -486,8 +486,10 @@ static int x25_asy_open(struct net_device *dev) ...@@ -486,8 +486,10 @@ static int x25_asy_open(struct net_device *dev)
/* Cleanup */ /* Cleanup */
kfree(sl->xbuff); kfree(sl->xbuff);
sl->xbuff = NULL;
noxbuff: noxbuff:
kfree(sl->rbuff); kfree(sl->rbuff);
sl->rbuff = NULL;
norbuff: norbuff:
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册