Subject: Re: [RESEND 3/5] [NET]: Protocol Independant Policy Routing Rules Framework

From: Patrick McHardy <[email-masked]>
Date: Fri, 28 Jul 2006 00:58:49 +0200

Thomas Graf wrote:
> Derived from net/ipv6/fib_rules.c

This clashes with my routing table patch, guess we have to figure
out who should go first :)

> +int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
> +		     int flags, struct fib_lookup_arg *arg)
> +{
> +	struct fib_rule *rule;
> +	int err;
> +
> +	rcu_read_lock();
> +
> +	list_for_each_entry(rule, ops->rules_list, list) {

Shouldn't that be list_for_each_entry_rcu?

> +		if (rule->ifname[0] && (rule->ifindex != fl->iif))
> +			continue;
> +
> +		if (!ops->match(rule, fl, flags))
> +			continue;
> +
> +		rcu_read_unlock();
> +
> +		err = ops->action(rule, fl, flags, arg);
> +		if (err != -EAGAIN) {
> +			fib_rule_get(rule);
> +			arg->rule = rule;
> +			goto out;
> +		}
> +	}
> +
> +	err = -ENETUNREACH;
> +out:
> +	rcu_read_unlock();

rcu_read_unlock might get called multiple times in the list iteration
and once again here.