Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
14b872f0
Commit
14b872f0
authored
Apr 19, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xt_hashlimit: allocate a copy of name explicitly, don't rely on procfs guts
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
89b107ad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
net/netfilter/xt_hashlimit.c
net/netfilter/xt_hashlimit.c
+11
-3
No files found.
net/netfilter/xt_hashlimit.c
View file @
14b872f0
...
@@ -107,6 +107,7 @@ struct xt_hashlimit_htable {
...
@@ -107,6 +107,7 @@ struct xt_hashlimit_htable {
/* seq_file stuff */
/* seq_file stuff */
struct
proc_dir_entry
*
pde
;
struct
proc_dir_entry
*
pde
;
const
char
*
name
;
struct
net
*
net
;
struct
net
*
net
;
struct
hlist_head
hash
[
0
];
/* hashtable itself */
struct
hlist_head
hash
[
0
];
/* hashtable itself */
...
@@ -253,6 +254,11 @@ static int htable_create(struct net *net, struct xt_hashlimit_mtinfo1 *minfo,
...
@@ -253,6 +254,11 @@ static int htable_create(struct net *net, struct xt_hashlimit_mtinfo1 *minfo,
hinfo
->
count
=
0
;
hinfo
->
count
=
0
;
hinfo
->
family
=
family
;
hinfo
->
family
=
family
;
hinfo
->
rnd_initialized
=
false
;
hinfo
->
rnd_initialized
=
false
;
hinfo
->
name
=
kstrdup
(
minfo
->
name
,
GFP_KERNEL
);
if
(
!
hinfo
->
name
)
{
vfree
(
hinfo
);
return
-
ENOMEM
;
}
spin_lock_init
(
&
hinfo
->
lock
);
spin_lock_init
(
&
hinfo
->
lock
);
hinfo
->
pde
=
proc_create_data
(
minfo
->
name
,
0
,
hinfo
->
pde
=
proc_create_data
(
minfo
->
name
,
0
,
...
@@ -260,6 +266,7 @@ static int htable_create(struct net *net, struct xt_hashlimit_mtinfo1 *minfo,
...
@@ -260,6 +266,7 @@ static int htable_create(struct net *net, struct xt_hashlimit_mtinfo1 *minfo,
hashlimit_net
->
ipt_hashlimit
:
hashlimit_net
->
ip6t_hashlimit
,
hashlimit_net
->
ipt_hashlimit
:
hashlimit_net
->
ip6t_hashlimit
,
&
dl_file_ops
,
hinfo
);
&
dl_file_ops
,
hinfo
);
if
(
hinfo
->
pde
==
NULL
)
{
if
(
hinfo
->
pde
==
NULL
)
{
kfree
(
hinfo
->
name
);
vfree
(
hinfo
);
vfree
(
hinfo
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
...
@@ -330,9 +337,10 @@ static void htable_destroy(struct xt_hashlimit_htable *hinfo)
...
@@ -330,9 +337,10 @@ static void htable_destroy(struct xt_hashlimit_htable *hinfo)
parent
=
hashlimit_net
->
ip6t_hashlimit
;
parent
=
hashlimit_net
->
ip6t_hashlimit
;
if
(
parent
!=
NULL
)
if
(
parent
!=
NULL
)
remove_proc_entry
(
hinfo
->
pde
->
name
,
parent
);
remove_proc_entry
(
hinfo
->
name
,
parent
);
htable_selective_cleanup
(
hinfo
,
select_all
);
htable_selective_cleanup
(
hinfo
,
select_all
);
kfree
(
hinfo
->
name
);
vfree
(
hinfo
);
vfree
(
hinfo
);
}
}
...
@@ -344,7 +352,7 @@ static struct xt_hashlimit_htable *htable_find_get(struct net *net,
...
@@ -344,7 +352,7 @@ static struct xt_hashlimit_htable *htable_find_get(struct net *net,
struct
xt_hashlimit_htable
*
hinfo
;
struct
xt_hashlimit_htable
*
hinfo
;
hlist_for_each_entry
(
hinfo
,
&
hashlimit_net
->
htables
,
node
)
{
hlist_for_each_entry
(
hinfo
,
&
hashlimit_net
->
htables
,
node
)
{
if
(
!
strcmp
(
name
,
hinfo
->
pde
->
name
)
&&
if
(
!
strcmp
(
name
,
hinfo
->
name
)
&&
hinfo
->
family
==
family
)
{
hinfo
->
family
==
family
)
{
hinfo
->
use
++
;
hinfo
->
use
++
;
return
hinfo
;
return
hinfo
;
...
@@ -887,7 +895,7 @@ static void __net_exit hashlimit_proc_net_exit(struct net *net)
...
@@ -887,7 +895,7 @@ static void __net_exit hashlimit_proc_net_exit(struct net *net)
pde
=
hashlimit_net
->
ip6t_hashlimit
;
pde
=
hashlimit_net
->
ip6t_hashlimit
;
hlist_for_each_entry
(
hinfo
,
&
hashlimit_net
->
htables
,
node
)
hlist_for_each_entry
(
hinfo
,
&
hashlimit_net
->
htables
,
node
)
remove_proc_entry
(
hinfo
->
pde
->
name
,
pde
);
remove_proc_entry
(
hinfo
->
name
,
pde
);
hashlimit_net
->
ipt_hashlimit
=
NULL
;
hashlimit_net
->
ipt_hashlimit
=
NULL
;
hashlimit_net
->
ip6t_hashlimit
=
NULL
;
hashlimit_net
->
ip6t_hashlimit
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment