From: Gao Feng <f...@ikuai8.com>

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

Signed-off-by: Gao Feng <f...@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


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to