tipc: check link name with right length in tipc_nl_compat_link_set
authorXin Long <lucien.xin@gmail.com>
Sun, 31 Mar 2019 14:50:09 +0000 (22:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 May 2019 07:58:57 +0000 (09:58 +0200)
commita0cb0faa15f3174ac0d1c5ca401ca80b4494b21d
treedcf84b81b4370f7ec4d9eb52af2ed64a16767d79
parentf21fae8049cd50d3873db21762f75a7bf950f7d2
tipc: check link name with right length in tipc_nl_compat_link_set

commit 8c63bf9ab4be8b83bd8c34aacfd2f1d2c8901c8a upstream.

A similar issue as fixed by Patch "tipc: check bearer name with right
length in tipc_nl_compat_bearer_enable" was also found by syzbot in
tipc_nl_compat_link_set().

The length to check with should be 'TLV_GET_DATA_LEN(msg->req) -
offsetof(struct tipc_link_config, name)'.

Reported-by: syzbot+de00a87b8644a582ae79@syzkaller.appspotmail.com
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/tipc/netlink_compat.c