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
4228d368
Commit
4228d368
authored
Mar 22, 2003
by
Bart De Schuymer
Committed by
David S. Miller
Mar 22, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EBTABLES] hold usage count on table module when it contains rules
parent
f055e6c7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
3 deletions
+18
-3
include/linux/netfilter_bridge/ebtables.h
include/linux/netfilter_bridge/ebtables.h
+1
-0
net/bridge/netfilter/ebtable_broute.c
net/bridge/netfilter/ebtable_broute.c
+1
-0
net/bridge/netfilter/ebtable_filter.c
net/bridge/netfilter/ebtable_filter.c
+1
-0
net/bridge/netfilter/ebtable_nat.c
net/bridge/netfilter/ebtable_nat.c
+1
-0
net/bridge/netfilter/ebtables.c
net/bridge/netfilter/ebtables.c
+14
-3
No files found.
include/linux/netfilter_bridge/ebtables.h
View file @
4228d368
...
...
@@ -260,6 +260,7 @@ struct ebt_table
unsigned
int
valid_hooks
);
/* the data used by the kernel */
struct
ebt_table_info
*
private
;
struct
module
*
me
;
};
extern
int
ebt_register_table
(
struct
ebt_table
*
table
);
...
...
net/bridge/netfilter/ebtable_broute.c
View file @
4228d368
...
...
@@ -49,6 +49,7 @@ static struct ebt_table broute_table =
.
valid_hooks
=
1
<<
NF_BR_BROUTING
,
.
lock
=
RW_LOCK_UNLOCKED
,
.
check
=
check
,
.
me
=
THIS_MODULE
,
};
static
int
ebt_broute
(
struct
sk_buff
**
pskb
)
...
...
net/bridge/netfilter/ebtable_filter.c
View file @
4228d368
...
...
@@ -57,6 +57,7 @@ static struct ebt_table frame_filter =
.
valid_hooks
=
FILTER_VALID_HOOKS
,
.
lock
=
RW_LOCK_UNLOCKED
,
.
check
=
check
,
.
me
=
THIS_MODULE
,
};
static
unsigned
int
...
...
net/bridge/netfilter/ebtable_nat.c
View file @
4228d368
...
...
@@ -56,6 +56,7 @@ static struct ebt_table frame_nat =
.
valid_hooks
=
NAT_VALID_HOOKS
,
.
lock
=
RW_LOCK_UNLOCKED
,
.
check
=
check
,
.
me
=
THIS_MODULE
,
};
static
unsigned
int
...
...
net/bridge/netfilter/ebtables.c
View file @
4228d368
...
...
@@ -969,8 +969,10 @@ static int do_replace(void *user, unsigned int len)
goto
free_counterstmp
;
t
=
find_table_lock
(
tmp
.
name
,
&
ret
,
&
ebt_mutex
);
if
(
!
t
)
if
(
!
t
)
{
ret
=
-
ENOENT
;
goto
free_iterate
;
}
/* the table doesn't like it */
if
(
t
->
check
&&
(
ret
=
t
->
check
(
newinfo
,
tmp
.
valid_hooks
)))
...
...
@@ -984,6 +986,12 @@ static int do_replace(void *user, unsigned int len)
/* we have the mutex lock, so no danger in reading this pointer */
table
=
t
->
private
;
/* make sure the table can only be rmmod'ed if it contains no rules */
if
(
!
table
->
nentries
&&
newinfo
->
nentries
&&
!
try_module_get
(
t
->
me
))
{
ret
=
-
ENOENT
;
goto
free_unlock
;
}
else
if
(
table
->
nentries
&&
!
newinfo
->
nentries
)
module_put
(
t
->
me
);
/* we need an atomic snapshot of the counters */
write_lock_bh
(
&
t
->
lock
);
if
(
tmp
.
num_counters
)
...
...
@@ -1168,6 +1176,11 @@ int ebt_register_table(struct ebt_table *table)
goto
free_unlock
;
}
/* Hold a reference count if the chains aren't empty */
if
(
newinfo
->
nentries
&&
!
try_module_get
(
table
->
me
))
{
ret
=
-
ENOENT
;
goto
free_unlock
;
}
list_prepend
(
&
ebt_tables
,
table
);
up
(
&
ebt_mutex
);
return
0
;
...
...
@@ -1196,8 +1209,6 @@ void ebt_unregister_table(struct ebt_table *table)
down
(
&
ebt_mutex
);
LIST_DELETE
(
&
ebt_tables
,
table
);
up
(
&
ebt_mutex
);
EBT_ENTRY_ITERATE
(
table
->
private
->
entries
,
table
->
private
->
entries_size
,
ebt_cleanup_entry
,
NULL
);
if
(
table
->
private
->
entries
)
vfree
(
table
->
private
->
entries
);
if
(
table
->
private
->
chainstack
)
{
...
...
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