summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2015-12-07 18:48:07 +0800
committerPablo Neira Ayuso <pablo@netfilter.org>2015-12-13 22:47:32 +0100
commita907e36d54e0ff836e55e04531be201bf6b4d8c8 (patch)
treee9f101437b20302966b7f5177691a9dc9800d2cb /include/linux
parentd3340b79ec8222d20453b1e7f261b017d1d09dc9 (diff)
downloadlinux-stable-a907e36d54e0ff836e55e04531be201bf6b4d8c8.tar.gz
linux-stable-a907e36d54e0ff836e55e04531be201bf6b4d8c8.tar.bz2
linux-stable-a907e36d54e0ff836e55e04531be201bf6b4d8c8.zip
netfilter: nf_tables: use reverse traversal commit_list in nf_tables_abort
When we use 'nft -f' to submit rules, it will build multiple rules into one netlink skb to send to kernel, kernel will process them one by one. meanwhile, it add the trans into commit_list to record every commit. if one of them's return value is -EAGAIN, status |= NFNL_BATCH_REPLAY will be marked. after all the process is done. it will roll back all the commits. now kernel use list_add_tail to add trans to commit, and use list_for_each_entry_safe to roll back. which means the order of adding and rollback is the same. that will cause some cases cannot work well, even trigger call trace, like: 1. add a set into table foo [return -EAGAIN]: commit_list = 'add set trans' 2. del foo: commit_list = 'add set trans' -> 'del set trans' -> 'del tab trans' then nf_tables_abort will be called to roll back: firstly process 'add set trans': case NFT_MSG_NEWSET: trans->ctx.table->use--; list_del_rcu(&nft_trans_set(trans)->list); it will del the set from the table foo, but it has removed when del table foo [step 2], then the kernel will panic. the right order of rollback should be: 'del tab trans' -> 'del set trans' -> 'add set trans'. which is opposite with commit_list order. so fix it by rolling back commits with reverse order in nf_tables_abort. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions