Skip to content

Commit e1e992e

Browse files
Jamal Hadi SalimDavid S. Miller
authored andcommitted
[NET_SCHED] protect action config/dump from irqs
(with no apologies to C Heston) On Mon, 2007-10-09 at 21:00 +0800, Herbert Xu wrote: On Sun, Sep 02, 2007 at 01:11:29PM +0000, Christian Kujau wrote: > > > > after upgrading to 2.6.23-rc5 (and applying davem's fix [0]), lockdep > > was quite noisy when I tried to shape my external (wireless) interface: > > > > [ 6400.534545] FahCore_78.exe/3552 just changed the state of lock: > > [ 6400.534713] (&dev->ingress_lock){-+..}, at: [<c038d595>] > > netif_receive_skb+0x2d5/0x3c0 > > [ 6400.534941] but this lock took another, soft-read-irq-unsafe lock in the > > past: > > [ 6400.535145] (police_lock){-.--} > > This is a genuine dead-lock. The police lock can be taken > for reading with softirqs on. If a second CPU tries to take > the police lock for writing, while holding the ingress lock, > then a softirq on the first CPU can dead-lock when it tries > to get the ingress lock. Signed-off-by: Jamal Hadi Salim <[email protected]> Acked-by: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4878809 commit e1e992e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

net/sched/act_api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
6868
int err = 0, index = -1,i = 0, s_i = 0, n_i = 0;
6969
struct rtattr *r ;
7070

71-
read_lock(hinfo->lock);
71+
read_lock_bh(hinfo->lock);
7272

7373
s_i = cb->args[0];
7474

@@ -96,7 +96,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
9696
}
9797
}
9898
done:
99-
read_unlock(hinfo->lock);
99+
read_unlock_bh(hinfo->lock);
100100
if (n_i)
101101
cb->args[0] += n_i;
102102
return n_i;
@@ -156,13 +156,13 @@ struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo)
156156
{
157157
struct tcf_common *p;
158158

159-
read_lock(hinfo->lock);
159+
read_lock_bh(hinfo->lock);
160160
for (p = hinfo->htab[tcf_hash(index, hinfo->hmask)]; p;
161161
p = p->tcfc_next) {
162162
if (p->tcfc_index == index)
163163
break;
164164
}
165-
read_unlock(hinfo->lock);
165+
read_unlock_bh(hinfo->lock);
166166

167167
return p;
168168
}

net/sched/act_police.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c
5656
int err = 0, index = -1, i = 0, s_i = 0, n_i = 0;
5757
struct rtattr *r;
5858

59-
read_lock(&police_lock);
59+
read_lock_bh(&police_lock);
6060

6161
s_i = cb->args[0];
6262

@@ -85,7 +85,7 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c
8585
}
8686
}
8787
done:
88-
read_unlock(&police_lock);
88+
read_unlock_bh(&police_lock);
8989
if (n_i)
9090
cb->args[0] += n_i;
9191
return n_i;

0 commit comments

Comments
 (0)