Skip to content

Commit 45e093a

Browse files
Richard Alpedavem330
Richard Alpe
authored andcommitted
tipc: check nl sock before parsing nested attributes
Make sure the socket for which the user is listing publication exists before parsing the socket netlink attributes. Prior to this patch a call without any socket caused a NULL pointer dereference in tipc_nl_publ_dump(). Tested-and-reported-by: Baozeng Ding <sploving1@gmail.com> Signed-off-by: Richard Alpe <richard.alpe@ericsson.com> Acked-by: Jon Maloy <jon.maloy@ericsson.cm> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 77f5776 commit 45e093a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: net/tipc/socket.c

+3
Original file line numberDiff line numberDiff line change
@@ -2853,6 +2853,9 @@ int tipc_nl_publ_dump(struct sk_buff *skb, struct netlink_callback *cb)
28532853
if (err)
28542854
return err;
28552855

2856+
if (!attrs[TIPC_NLA_SOCK])
2857+
return -EINVAL;
2858+
28562859
err = nla_parse_nested(sock, TIPC_NLA_SOCK_MAX,
28572860
attrs[TIPC_NLA_SOCK],
28582861
tipc_nl_sock_policy);

0 commit comments

Comments
 (0)