tipc: fix null deref crash in compat config path
authorFlorian Westphal <fw@strlen.de>
Wed, 24 Feb 2016 16:20:17 +0000 (17:20 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Feb 2016 22:04:48 +0000 (17:04 -0500)
msg.dst_sk needs to be set up with a valid socket because some callbacks
later derive the netns from it.

Fixes: 263ea09084d172d ("Revert "genl: Add genlmsg_new_unicast() for unicast message allocation")
Reported-by: Jon Maloy <maloy@donjonn.com>
Bisected-by: Jon Maloy <maloy@donjonn.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/netlink_compat.c

index de66d8f945ed66685b8a4a1ff0d3775981ec6c2f..d7d050f44fc131942b5e87ab3ce23edbc8376684 100644 (file)
@@ -1105,6 +1105,7 @@ static int tipc_nl_compat_recv(struct sk_buff *skb, struct genl_info *info)
        msg.req = nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN;
        msg.cmd = req_userhdr->cmd;
        msg.net = genl_info_net(info);
+       msg.dst_sk = skb->sk;
 
        if ((msg.cmd & 0xC000) && (!netlink_net_capable(skb, CAP_NET_ADMIN))) {
                msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_NET_ADMIN);