summaryrefslogtreecommitdiff
path: root/sock.c
AgeCommit message (Expand)AuthorFilesLines
2013-06-14sock: Check return value of setsockopt() in set_tcp_nodelay()Tobias Klauser1-2/+5
2013-06-04sock: add socket management functionsDaniel Borkmann1-0/+176
pt>
authorXin Long <lucien.xin@gmail.com>2016-12-20 19:14:34 +0800
committerPablo Neira Ayuso <pablo@netfilter.org>2016-12-23 15:20:01 +0100
commit6c5d5cfbe3c59429e6d6f66477a7609aacf69751 (patch)
tree19435ae7ae7d2fe3d802de8672a535597eca32ab
parent053d20f5712529016eae10356e0dea9b360325bd (diff)
netfilter: ipt_CLUSTERIP: check duplicate config when initializing
Now when adding an ipt_CLUSTERIP rule, it only checks duplicate config in clusterip_config_find_get(). But after that, there may be still another thread to insert a config with the same ip, then it leaves proc_create_data to do duplicate check. It's more reasonable to check duplicate config by ipt_CLUSTERIP itself, instead of checking it by proc fs duplicate file check. Before, when proc fs allowed duplicate name files in a directory, It could even crash kernel because of use-after-free. This patch is to check duplicate config under the protection of clusterip net lock when initializing a new config and correct the return err. Note that it also moves proc file node creation after adding new config, as proc_create_data may sleep, it couldn't be called under the clusterip_net lock. clusterip_config_find_get returns NULL if c->pde is null to make sure it can't be used until the proc file node creation is done. Suggested-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat