diff options
Diffstat (limited to 'net/tipc/netlink_compat.c')
-rw-r--r-- | net/tipc/netlink_compat.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c index d86030ef1232..e135d4e11231 100644 --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c | |||
@@ -55,6 +55,7 @@ struct tipc_nl_compat_msg { | |||
55 | int rep_type; | 55 | int rep_type; |
56 | int rep_size; | 56 | int rep_size; |
57 | int req_type; | 57 | int req_type; |
58 | int req_size; | ||
58 | struct net *net; | 59 | struct net *net; |
59 | struct sk_buff *rep; | 60 | struct sk_buff *rep; |
60 | struct tlv_desc *req; | 61 | struct tlv_desc *req; |
@@ -257,7 +258,8 @@ static int tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd, | |||
257 | int err; | 258 | int err; |
258 | struct sk_buff *arg; | 259 | struct sk_buff *arg; |
259 | 260 | ||
260 | if (msg->req_type && !TLV_CHECK_TYPE(msg->req, msg->req_type)) | 261 | if (msg->req_type && (!msg->req_size || |
262 | !TLV_CHECK_TYPE(msg->req, msg->req_type))) | ||
261 | return -EINVAL; | 263 | return -EINVAL; |
262 | 264 | ||
263 | msg->rep = tipc_tlv_alloc(msg->rep_size); | 265 | msg->rep = tipc_tlv_alloc(msg->rep_size); |
@@ -354,7 +356,8 @@ static int tipc_nl_compat_doit(struct tipc_nl_compat_cmd_doit *cmd, | |||
354 | { | 356 | { |
355 | int err; | 357 | int err; |
356 | 358 | ||
357 | if (msg->req_type && !TLV_CHECK_TYPE(msg->req, msg->req_type)) | 359 | if (msg->req_type && (!msg->req_size || |
360 | !TLV_CHECK_TYPE(msg->req, msg->req_type))) | ||
358 | return -EINVAL; | 361 | return -EINVAL; |
359 | 362 | ||
360 | err = __tipc_nl_compat_doit(cmd, msg); | 363 | err = __tipc_nl_compat_doit(cmd, msg); |
@@ -1278,8 +1281,8 @@ static int tipc_nl_compat_recv(struct sk_buff *skb, struct genl_info *info) | |||
1278 | goto send; | 1281 | goto send; |
1279 | } | 1282 | } |
1280 | 1283 | ||
1281 | len = nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN); | 1284 | msg.req_size = nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN); |
1282 | if (!len || !TLV_OK(msg.req, len)) { | 1285 | if (msg.req_size && !TLV_OK(msg.req, msg.req_size)) { |
1283 | msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); | 1286 | msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); |
1284 | err = -EOPNOTSUPP; | 1287 | err = -EOPNOTSUPP; |
1285 | goto send; | 1288 | goto send; |