summaryrefslogtreecommitdiffstats
path: root/net/openvswitch/conntrack.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-05-01 15:41:58 +0200
committerDavid S. Miller <davem@davemloft.net>2019-05-05 09:52:07 +0200
commitca96534630e2edfd73121c487c957b17eca3b7d7 (patch)
treeea6ce737f3ecae9b9a8dd08dac5a4e538cd18891 /net/openvswitch/conntrack.c
parentMerge branch 'ipv4-Move-location-of-pcpu-route-cache-and-exceptions' (diff)
downloadlinux-ca96534630e2edfd73121c487c957b17eca3b7d7.tar.xz
linux-ca96534630e2edfd73121c487c957b17eca3b7d7.zip
openvswitch: check for null pointer return from nla_nest_start_noflag
The call to nla_nest_start_noflag can return null in the unlikely event that nla_put returns -EMSGSIZE. Check for this condition to avoid a null pointer dereference on pointer nla_reply. Addresses-Coverity: ("Dereference null return value") Fixes: 11efd5cb04a1 ("openvswitch: Support conntrack zone limit") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/conntrack.c')
-rw-r--r--net/openvswitch/conntrack.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index bded32144619..caeabf5215e8 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -2161,6 +2161,10 @@ static int ovs_ct_limit_cmd_get(struct sk_buff *skb, struct genl_info *info)
return PTR_ERR(reply);
nla_reply = nla_nest_start_noflag(reply, OVS_CT_LIMIT_ATTR_ZONE_LIMIT);
+ if (!nla_reply) {
+ err = -EMSGSIZE;
+ goto exit_err;
+ }
if (a[OVS_CT_LIMIT_ATTR_ZONE_LIMIT]) {
err = ovs_ct_limit_get_zone_limit(