diff options
-rw-r--r-- | include/linux/netfilter.h | 3 | ||||
-rw-r--r-- | net/netfilter/nf_queue.c | 7 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_queue.c | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 10b5c62757..0eed0b7ab2 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -275,7 +275,8 @@ struct nf_queue_handler { | |||
275 | }; | 275 | }; |
276 | extern int nf_register_queue_handler(int pf, | 276 | extern int nf_register_queue_handler(int pf, |
277 | struct nf_queue_handler *qh); | 277 | struct nf_queue_handler *qh); |
278 | extern int nf_unregister_queue_handler(int pf); | 278 | extern int nf_unregister_queue_handler(int pf, |
279 | struct nf_queue_handler *qh); | ||
279 | extern void nf_unregister_queue_handlers(struct nf_queue_handler *qh); | 280 | extern void nf_unregister_queue_handlers(struct nf_queue_handler *qh); |
280 | extern void nf_reinject(struct sk_buff *skb, | 281 | extern void nf_reinject(struct sk_buff *skb, |
281 | struct nf_info *info, | 282 | struct nf_info *info, |
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c index b1f2ace96f..f402894d7e 100644 --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c | |||
@@ -44,12 +44,17 @@ int nf_register_queue_handler(int pf, struct nf_queue_handler *qh) | |||
44 | EXPORT_SYMBOL(nf_register_queue_handler); | 44 | EXPORT_SYMBOL(nf_register_queue_handler); |
45 | 45 | ||
46 | /* The caller must flush their queue before this */ | 46 | /* The caller must flush their queue before this */ |
47 | int nf_unregister_queue_handler(int pf) | 47 | int nf_unregister_queue_handler(int pf, struct nf_queue_handler *qh) |
48 | { | 48 | { |
49 | if (pf >= NPROTO) | 49 | if (pf >= NPROTO) |
50 | return -EINVAL; | 50 | return -EINVAL; |
51 | 51 | ||
52 | write_lock_bh(&queue_handler_lock); | 52 | write_lock_bh(&queue_handler_lock); |
53 | if (queue_handler[pf] != qh) { | ||
54 | write_unlock_bh(&queue_handler_lock); | ||
55 | return -EINVAL; | ||
56 | } | ||
57 | |||
53 | queue_handler[pf] = NULL; | 58 | queue_handler[pf] = NULL; |
54 | write_unlock_bh(&queue_handler_lock); | 59 | write_unlock_bh(&queue_handler_lock); |
55 | 60 | ||
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 7a97bec677..7d47fc4b19 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -913,9 +913,7 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb, | |||
913 | case NFQNL_CFG_CMD_PF_UNBIND: | 913 | case NFQNL_CFG_CMD_PF_UNBIND: |
914 | QDEBUG("unregistering queue handler for pf=%u\n", | 914 | QDEBUG("unregistering queue handler for pf=%u\n", |
915 | ntohs(cmd->pf)); | 915 | ntohs(cmd->pf)); |
916 | /* This is a bug and a feature. We can unregister | 916 | ret = nf_unregister_queue_handler(ntohs(cmd->pf), &nfqh); |
917 | * other handlers(!) */ | ||
918 | ret = nf_unregister_queue_handler(ntohs(cmd->pf)); | ||
919 | break; | 917 | break; |
920 | default: | 918 | default: |
921 | ret = -EINVAL; | 919 | ret = -EINVAL; |