Commit 914afea84e3e20cdbcd040f8387a0e6ef20ffc97

Authored by Patrick McHardy
Committed by David S. Miller
1 parent b7047a1c88

[NETFILTER]: nfnetlink_queue: fix EPERM when binding/unbinding and instance 0 exists

Similar to the nfnetlink_log problem, nfnetlink_queue incorrectly
returns -EPERM when binding or unbinding to an address family and
queueing instance 0 exists and is owned by a different process. Unlike
nfnetlink_log it previously completes the operation, but it is still
incorrect.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 4 additions and 11 deletions Side-by-side Diff

net/netfilter/nfnetlink_queue.c
... ... @@ -703,19 +703,12 @@
703 703 /* Commands without queue context - might sleep */
704 704 switch (cmd->command) {
705 705 case NFQNL_CFG_CMD_PF_BIND:
706   - ret = nf_register_queue_handler(ntohs(cmd->pf),
707   - &nfqh);
708   - break;
  706 + return nf_register_queue_handler(ntohs(cmd->pf),
  707 + &nfqh);
709 708 case NFQNL_CFG_CMD_PF_UNBIND:
710   - ret = nf_unregister_queue_handler(ntohs(cmd->pf),
711   - &nfqh);
712   - break;
713   - default:
714   - break;
  709 + return nf_unregister_queue_handler(ntohs(cmd->pf),
  710 + &nfqh);
715 711 }
716   -
717   - if (ret < 0)
718   - return ret;
719 712 }
720 713  
721 714 rcu_read_lock();