]> git.baikalelectronics.ru Git - kernel.git/commit
tipc: fix use-after-free in tipc_disc_rcv()
authorTuong Lien <tuong.t.lien@dektech.com.au>
Tue, 10 Dec 2019 08:21:05 +0000 (15:21 +0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Dec 2019 01:45:04 +0000 (17:45 -0800)
commit0688594b66904067686bef63a9f24b172845f0ec
tree5d8a20136f6e21f51bf569332b008a9fbb69527b
parente74fc7ae4c688c6d25e318f6c06ee6e54b49afe2
tipc: fix use-after-free in tipc_disc_rcv()

In the function 'tipc_disc_rcv()', the 'msg_peer_net_hash()' is called
to read the header data field but after the message skb has been freed,
that might result in a garbage value...

This commit fixes it by defining a new local variable to store the data
first, just like the other header fields' handling.

Fixes: 5248c6f8694f ("tipc: improve throughput between nodes in netns")
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/discover.c