diff mbox series

nfnetlink_cthelper: make userspace conntrack helpers with priv data work again

Message ID i1P7xDy04ZUlF7D-m77iaXyon7w4xX3QJP3V3QlqUkfqDCVsSMhzty0ILwQ1_78m4FvM7JogSLOnTG-oC2y55dPYZQVo5IyefRDvkr4UI3Y=@protonmail.com
State Not Applicable
Delegated to: Pablo Neira
Headers show
Series nfnetlink_cthelper: make userspace conntrack helpers with priv data work again | expand

Commit Message

a_hungrig Oct. 15, 2019, 9:17 p.m. UTC
Hi,

had trouble getting the userspace cthelper for ftp working, tracked down the problem to incorrect length and incorrect params to nla_memcpy() when handling the helper's priv data in kernel.


--

Regards
a_h
diff mbox series

Patch

--- net/netfilter/nfnetlink_cthelper.c.orig     2019-10-11 18:21:44.000000000 +0200
+++ net/netfilter/nfnetlink_cthelper.c  2019-10-15 22:00:21.159986725 +0200
@@ -106,7 +106,7 @@  nfnl_cthelper_from_nlattr(struct nlattr
        if (help->helper->data_len == 0)
                return -EINVAL;

-       nla_memcpy(help->data, nla_data(attr), sizeof(help->data));
+       nla_memcpy(help->data, attr, help->helper->data_len);
        return 0;
 }

@@ -242,6 +242,7 @@  nfnl_cthelper_create(const struct nlattr
                ret = -ENOMEM;
                goto err2;
        }
+       helper->data_len = size;

        helper->flags |= NF_CT_HELPER_F_USERSPACE;
        memcpy(&helper->tuple, tuple, sizeof(struct nf_conntrack_tuple));