diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/bridge/netfilter/ebt_mark.c | 31 | ||||
-rw-r--r-- | net/bridge/netfilter/ebt_mark_m.c | 37 |
2 files changed, 68 insertions, 0 deletions
diff --git a/net/bridge/netfilter/ebt_mark.c b/net/bridge/netfilter/ebt_mark.c index 153e167374a2..2b5ce533d6b9 100644 --- a/net/bridge/netfilter/ebt_mark.c +++ b/net/bridge/netfilter/ebt_mark.c | |||
@@ -52,6 +52,32 @@ static bool ebt_mark_tg_check(const struct xt_tgchk_param *par) | |||
52 | return false; | 52 | return false; |
53 | return true; | 53 | return true; |
54 | } | 54 | } |
55 | #ifdef CONFIG_COMPAT | ||
56 | struct compat_ebt_mark_t_info { | ||
57 | compat_ulong_t mark; | ||
58 | compat_uint_t target; | ||
59 | }; | ||
60 | |||
61 | static void mark_tg_compat_from_user(void *dst, const void *src) | ||
62 | { | ||
63 | const struct compat_ebt_mark_t_info *user = src; | ||
64 | struct ebt_mark_t_info *kern = dst; | ||
65 | |||
66 | kern->mark = user->mark; | ||
67 | kern->target = user->target; | ||
68 | } | ||
69 | |||
70 | static int mark_tg_compat_to_user(void __user *dst, const void *src) | ||
71 | { | ||
72 | struct compat_ebt_mark_t_info __user *user = dst; | ||
73 | const struct ebt_mark_t_info *kern = src; | ||
74 | |||
75 | if (put_user(kern->mark, &user->mark) || | ||
76 | put_user(kern->target, &user->target)) | ||
77 | return -EFAULT; | ||
78 | return 0; | ||
79 | } | ||
80 | #endif | ||
55 | 81 | ||
56 | static struct xt_target ebt_mark_tg_reg __read_mostly = { | 82 | static struct xt_target ebt_mark_tg_reg __read_mostly = { |
57 | .name = "mark", | 83 | .name = "mark", |
@@ -60,6 +86,11 @@ static struct xt_target ebt_mark_tg_reg __read_mostly = { | |||
60 | .target = ebt_mark_tg, | 86 | .target = ebt_mark_tg, |
61 | .checkentry = ebt_mark_tg_check, | 87 | .checkentry = ebt_mark_tg_check, |
62 | .targetsize = sizeof(struct ebt_mark_t_info), | 88 | .targetsize = sizeof(struct ebt_mark_t_info), |
89 | #ifdef CONFIG_COMPAT | ||
90 | .compatsize = sizeof(struct compat_ebt_mark_t_info), | ||
91 | .compat_from_user = mark_tg_compat_from_user, | ||
92 | .compat_to_user = mark_tg_compat_to_user, | ||
93 | #endif | ||
63 | .me = THIS_MODULE, | 94 | .me = THIS_MODULE, |
64 | }; | 95 | }; |
65 | 96 | ||
diff --git a/net/bridge/netfilter/ebt_mark_m.c b/net/bridge/netfilter/ebt_mark_m.c index 89abf4030399..8de8c396d913 100644 --- a/net/bridge/netfilter/ebt_mark_m.c +++ b/net/bridge/netfilter/ebt_mark_m.c | |||
@@ -35,6 +35,38 @@ static bool ebt_mark_mt_check(const struct xt_mtchk_param *par) | |||
35 | return true; | 35 | return true; |
36 | } | 36 | } |
37 | 37 | ||
38 | |||
39 | #ifdef CONFIG_COMPAT | ||
40 | struct compat_ebt_mark_m_info { | ||
41 | compat_ulong_t mark, mask; | ||
42 | uint8_t invert, bitmask; | ||
43 | }; | ||
44 | |||
45 | static void mark_mt_compat_from_user(void *dst, const void *src) | ||
46 | { | ||
47 | const struct compat_ebt_mark_m_info *user = src; | ||
48 | struct ebt_mark_m_info *kern = dst; | ||
49 | |||
50 | kern->mark = user->mark; | ||
51 | kern->mask = user->mask; | ||
52 | kern->invert = user->invert; | ||
53 | kern->bitmask = user->bitmask; | ||
54 | } | ||
55 | |||
56 | static int mark_mt_compat_to_user(void __user *dst, const void *src) | ||
57 | { | ||
58 | struct compat_ebt_mark_m_info __user *user = dst; | ||
59 | const struct ebt_mark_m_info *kern = src; | ||
60 | |||
61 | if (put_user(kern->mark, &user->mark) || | ||
62 | put_user(kern->mask, &user->mask) || | ||
63 | put_user(kern->invert, &user->invert) || | ||
64 | put_user(kern->bitmask, &user->bitmask)) | ||
65 | return -EFAULT; | ||
66 | return 0; | ||
67 | } | ||
68 | #endif | ||
69 | |||
38 | static struct xt_match ebt_mark_mt_reg __read_mostly = { | 70 | static struct xt_match ebt_mark_mt_reg __read_mostly = { |
39 | .name = "mark_m", | 71 | .name = "mark_m", |
40 | .revision = 0, | 72 | .revision = 0, |
@@ -42,6 +74,11 @@ static struct xt_match ebt_mark_mt_reg __read_mostly = { | |||
42 | .match = ebt_mark_mt, | 74 | .match = ebt_mark_mt, |
43 | .checkentry = ebt_mark_mt_check, | 75 | .checkentry = ebt_mark_mt_check, |
44 | .matchsize = sizeof(struct ebt_mark_m_info), | 76 | .matchsize = sizeof(struct ebt_mark_m_info), |
77 | #ifdef CONFIG_COMPAT | ||
78 | .compatsize = sizeof(struct compat_ebt_mark_m_info), | ||
79 | .compat_from_user = mark_mt_compat_from_user, | ||
80 | .compat_to_user = mark_mt_compat_to_user, | ||
81 | #endif | ||
45 | .me = THIS_MODULE, | 82 | .me = THIS_MODULE, |
46 | }; | 83 | }; |
47 | 84 | ||