mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
net/wan: fix a double free in x25_asy_open_tty()
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: 3b780bed31
("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>
This commit is contained in:
parent
c433570458
commit
d5c7c745f2
1 changed files with 2 additions and 0 deletions
|
@ -485,8 +485,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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue