mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 17:24:17 +08:00
[NETFILTER]: arp_tables: fix table locking in arpt_do_table
table->private might change because of ruleset changes, don't use it without holding the lock. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2d8f613160
commit
e0b7cde997
@ -236,7 +236,7 @@ unsigned int arpt_do_table(struct sk_buff **pskb,
|
|||||||
struct arpt_entry *e, *back;
|
struct arpt_entry *e, *back;
|
||||||
const char *indev, *outdev;
|
const char *indev, *outdev;
|
||||||
void *table_base;
|
void *table_base;
|
||||||
struct xt_table_info *private = table->private;
|
struct xt_table_info *private;
|
||||||
|
|
||||||
/* ARP header, plus 2 device addresses, plus 2 IP addresses. */
|
/* ARP header, plus 2 device addresses, plus 2 IP addresses. */
|
||||||
if (!pskb_may_pull((*pskb), (sizeof(struct arphdr) +
|
if (!pskb_may_pull((*pskb), (sizeof(struct arphdr) +
|
||||||
@ -248,6 +248,7 @@ unsigned int arpt_do_table(struct sk_buff **pskb,
|
|||||||
outdev = out ? out->name : nulldevname;
|
outdev = out ? out->name : nulldevname;
|
||||||
|
|
||||||
read_lock_bh(&table->lock);
|
read_lock_bh(&table->lock);
|
||||||
|
private = table->private;
|
||||||
table_base = (void *)private->entries[smp_processor_id()];
|
table_base = (void *)private->entries[smp_processor_id()];
|
||||||
e = get_entry(table_base, private->hook_entry[hook]);
|
e = get_entry(table_base, private->hook_entry[hook]);
|
||||||
back = get_entry(table_base, private->underflow[hook]);
|
back = get_entry(table_base, private->underflow[hook]);
|
||||||
|
Loading…
Reference in New Issue
Block a user