Skip to content

Commit 1a30449

Browse files
committed
Merge branch 'tc-action-fixes'
Vlad Buslov says: ==================== Fixes for miss to tc action series Changes V1 -> V2: - Added new patch reverting Ivan's fix for the same issue. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 26312c6 + fd741f0 commit 1a30449

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

net/sched/cls_flower.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,10 +2210,10 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
22102210
spin_lock(&tp->lock);
22112211
if (!handle) {
22122212
handle = 1;
2213-
err = idr_alloc_u32(&head->handle_idr, fnew, &handle,
2213+
err = idr_alloc_u32(&head->handle_idr, NULL, &handle,
22142214
INT_MAX, GFP_ATOMIC);
22152215
} else {
2216-
err = idr_alloc_u32(&head->handle_idr, fnew, &handle,
2216+
err = idr_alloc_u32(&head->handle_idr, NULL, &handle,
22172217
handle, GFP_ATOMIC);
22182218

22192219
/* Filter with specified handle was concurrently
@@ -2231,8 +2231,8 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
22312231
kfree(fnew);
22322232
goto errout_tb;
22332233
}
2234-
fnew->handle = handle;
22352234
}
2235+
fnew->handle = handle;
22362236

22372237
err = tcf_exts_init_ex(&fnew->exts, net, TCA_FLOWER_ACT, 0, tp, handle,
22382238
!tc_skip_hw(fnew->flags));
@@ -2339,7 +2339,8 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
23392339
errout_mask:
23402340
fl_mask_put(head, fnew->mask);
23412341
errout_idr:
2342-
idr_remove(&head->handle_idr, fnew->handle);
2342+
if (!fold)
2343+
idr_remove(&head->handle_idr, fnew->handle);
23432344
__fl_put(fnew);
23442345
errout_tb:
23452346
kfree(tb);
@@ -2378,7 +2379,7 @@ static void fl_walk(struct tcf_proto *tp, struct tcf_walker *arg,
23782379
rcu_read_lock();
23792380
idr_for_each_entry_continue_ul(&head->handle_idr, f, tmp, id) {
23802381
/* don't return filters that are being deleted */
2381-
if (!refcount_inc_not_zero(&f->refcnt))
2382+
if (!f || !refcount_inc_not_zero(&f->refcnt))
23822383
continue;
23832384
rcu_read_unlock();
23842385

0 commit comments

Comments
 (0)