From: Richard Alpe Date: Mon, 17 Aug 2015 12:15:10 +0000 (+0200) Subject: tipc: don't sanity check non-existing TLV (NL compat) X-Git-Tag: v4.3-rc1~96^2~162 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8f8ff9135b28a7560a5627aceaf289e3f0d4cd64;p=karo-tx-linux.git tipc: don't sanity check non-existing TLV (NL compat) A zero length payload means that no TLV (Type Length Value) data has been passed. Prior to this patch a non-existing TLV could be sanity checked with TLV_OK() resulting in random behavior where a user sending an empty message occasionally got a incorrect "operation not supported" message back. Signed-off-by: Richard Alpe Reviewed-by: Erik Hugne Signed-off-by: David S. Miller --- diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c index 53e0fee80086..1eadc95e1132 100644 --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c @@ -1114,7 +1114,7 @@ static int tipc_nl_compat_recv(struct sk_buff *skb, struct genl_info *info) } len = nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN); - if (TLV_GET_LEN(msg.req) && !TLV_OK(msg.req, len)) { + if (len && !TLV_OK(msg.req, len)) { msg.rep = tipc_get_err_tlv(TIPC_CFG_NOT_SUPPORTED); err = -EOPNOTSUPP; goto send;