Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6304
b: refs/heads/master
c: d72367b
h: refs/heads/master
v: v3
  • Loading branch information
Harald Welte authored and David S. Miller committed Aug 29, 2005
1 parent e7a9105 commit 1591a3e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bbd86b9fc469b7e91dc7444e6abb8930811d79cb
refs/heads/master: d72367b6f36e557f122beefaa8c6b80eb1c7f245
6 changes: 5 additions & 1 deletion trunk/net/netfilter/nf_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
static struct nf_logger *nf_logging[NPROTO]; /* = NULL */
static DEFINE_SPINLOCK(nf_log_lock);

/* return EBUSY if somebody else is registered, EEXIST if the same logger
* is registred, 0 on success. */
int nf_log_register(int pf, struct nf_logger *logger)
{
int ret = -EBUSY;
Expand All @@ -28,7 +30,9 @@ int nf_log_register(int pf, struct nf_logger *logger)
if (!nf_logging[pf]) {
rcu_assign_pointer(nf_logging[pf], logger);
ret = 0;
}
} else if (nf_logging[pf] == logger)
ret = -EEXIST;

spin_unlock(&nf_log_lock);
return ret;
}
Expand Down
6 changes: 5 additions & 1 deletion trunk/net/netfilter/nf_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ static struct nf_queue_rerouter *queue_rerouter;

static DEFINE_RWLOCK(queue_handler_lock);

/* return EBUSY when somebody else is registered, return EEXIST if the
* same handler is registered, return 0 in case of success. */
int nf_register_queue_handler(int pf, struct nf_queue_handler *qh)
{
int ret;
Expand All @@ -28,7 +30,9 @@ int nf_register_queue_handler(int pf, struct nf_queue_handler *qh)
return -EINVAL;

write_lock_bh(&queue_handler_lock);
if (queue_handler[pf])
if (queue_handler[pf] == qh)
ret = -EEXIST;
else if (queue_handler[pf])
ret = -EBUSY;
else {
queue_handler[pf] = qh;
Expand Down

0 comments on commit 1591a3e

Please sign in to comment.