mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
tipc: fix possible crash in __tipc_nl_net_set()
syzbot reported a crash in __tipc_nl_net_set() caused by NULL dereference.
We need to check that both TIPC_NLA_NET_NODEID and TIPC_NLA_NET_NODEID_W1
are present.
We also need to make sure userland provided u64 attributes.
Fixes: d50ccc2d39
("tipc: add 128-bit node identifier")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jon Maloy <jon.maloy@ericsson.com>
Cc: Ying Xue <ying.xue@windriver.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ec518f21cb
commit
c6404122cb
2 changed files with 4 additions and 0 deletions
|
@ -252,6 +252,8 @@ int __tipc_nl_net_set(struct sk_buff *skb, struct genl_info *info)
|
|||
u64 *w0 = (u64 *)&node_id[0];
|
||||
u64 *w1 = (u64 *)&node_id[8];
|
||||
|
||||
if (!attrs[TIPC_NLA_NET_NODEID_W1])
|
||||
return -EINVAL;
|
||||
*w0 = nla_get_u64(attrs[TIPC_NLA_NET_NODEID]);
|
||||
*w1 = nla_get_u64(attrs[TIPC_NLA_NET_NODEID_W1]);
|
||||
tipc_net_init(net, node_id, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue