netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf-next] netfilter: xt_TEE: Add the missed return value check in tee_tg_check
@ 2016-09-08  3:22 fgao
  2016-09-08  8:34 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: fgao @ 2016-09-08  3:22 UTC (permalink / raw)
  To: pablo, netfilter-devel, coreteam; +Cc: gfree.wind, Gao Feng

From: Gao Feng <fgao@ikuai8.com>

The original codes didn't check the return value of function
register_netdevice_notifier.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
---
 net/netfilter/xt_TEE.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c
index 6e57a39..0471db4 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -89,6 +89,8 @@ static int tee_tg_check(const struct xt_tgchk_param *par)
 		return -EINVAL;
 
 	if (info->oif[0]) {
+		int ret;
+
 		if (info->oif[sizeof(info->oif)-1] != '\0')
 			return -EINVAL;
 
@@ -101,7 +103,11 @@ static int tee_tg_check(const struct xt_tgchk_param *par)
 		priv->notifier.notifier_call = tee_netdev_event;
 		info->priv    = priv;
 
-		register_netdevice_notifier(&priv->notifier);
+		ret = register_netdevice_notifier(&priv->notifier);
+		if (ret) {
+			kfree(priv);
+			return ret;
+		}
 	} else
 		info->priv = NULL;
 
-- 
1.9.1



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

* Re: [PATCH nf-next] netfilter: xt_TEE: Add the missed return value check in tee_tg_check
  2016-09-08  3:22 [PATCH nf-next] netfilter: xt_TEE: Add the missed return value check in tee_tg_check fgao
@ 2016-09-08  8:34 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2016-09-08  8:34 UTC (permalink / raw)
  To: fgao; +Cc: netfilter-devel, coreteam, gfree.wind

On Thu, Sep 08, 2016 at 11:22:56AM +0800, fgao@ikuai8.com wrote:
> From: Gao Feng <fgao@ikuai8.com>
> 
> The original codes didn't check the return value of function
> register_netdevice_notifier.

net/netfilter/nf_tables_netdev.c: register_netdevice_notifier(&nf_tables_netdev_notifier);
net/netfilter/nfnetlink_queue.c: register_netdevice_notifier(&nfqnl_dev_notifier);

I can track a few more calls in the netfilter tree, I'd suggest you
fix them in one go given they are part of the same logical change
(they fit very weel into one single patch description).

Thanks!

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

end of thread, other threads:[~2016-09-08  8:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-08  3:22 [PATCH nf-next] netfilter: xt_TEE: Add the missed return value check in tee_tg_check fgao
2016-09-08  8:34 ` Pablo Neira Ayuso

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).