From: Gustavo A. R. Silva Date: Tue, 14 Nov 2017 20:26:16 +0000 (-0600) Subject: openvswitch: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b74912a2fdae9aadd20da502644aa8848c861954;p=openwrt%2Fstaging%2Fblogic.git openvswitch: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start It seems that the intention of the code is to null check the value returned by function genlmsg_put. But the current code is null checking the address of the pointer that holds the value returned by genlmsg_put. Fix this by properly null checking the value returned by function genlmsg_put in order to avoid a pontential null pointer dereference. Addresses-Coverity-ID: 1461561 ("Dereference before null check") Addresses-Coverity-ID: 1461562 ("Dereference null return value") Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure") Signed-off-by: Gustavo A. R. Silva Signed-off-by: David S. Miller --- diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c index 52ddd6c408b3..3fbfc78991ac 100644 --- a/net/openvswitch/meter.c +++ b/net/openvswitch/meter.c @@ -99,7 +99,7 @@ ovs_meter_cmd_reply_start(struct genl_info *info, u8 cmd, *ovs_reply_header = genlmsg_put(skb, info->snd_portid, info->snd_seq, &dp_meter_genl_family, 0, cmd); - if (!ovs_reply_header) { + if (!*ovs_reply_header) { nlmsg_free(skb); return ERR_PTR(-EMSGSIZE); }