netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] openvswitch: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start
@ 2017-11-14 20:26 Gustavo A. R. Silva
       [not found] ` <20171114202616.GA10862-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2017-11-14 20:26 UTC (permalink / raw)
  To: Pravin Shelar, David S. Miller
  Cc: netdev, dev, linux-kernel, Gustavo A. R. Silva

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 <garsilva@embeddedor.com>
---
 net/openvswitch/meter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 2a5ba35..bc0b6fc 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -106,7 +106,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);
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] openvswitch: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start
       [not found] ` <20171114202616.GA10862-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
@ 2017-11-15  5:18   ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-11-15  5:18 UTC (permalink / raw)
  To: garsilva-L1vi/lXTdts+Va1GwOuvDg
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
	pshelar-l0M0P4e3n4LQT0dZR+AlfA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: "Gustavo A. R. Silva" <garsilva-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
Date: Tue, 14 Nov 2017 14:26:16 -0600

> 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 <garsilva-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-15  5:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-14 20:26 [PATCH] openvswitch: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start Gustavo A. R. Silva
     [not found] ` <20171114202616.GA10862-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
2017-11-15  5:18   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).