453 err = route4_set_parms(tp, base, f, handle, head, tb,
454 tca[TCA_RATE], 0);
455 if (err < 0)
456 return err;
457
458 goto reinsert;
459 }
460
461 err = -ENOBUFS;
462 if (head == NULL) {
463 head = kzalloc(sizeof(struct route4_head), GFP_KERNEL);
464 if (head == NULL)
465 goto errout;
466
467 tcf_tree_lock(tp);
468 tp->root = head;
469 tcf_tree_unlock(tp);
470 }
471
472 f = kzalloc(sizeof(struct route4_filter), GFP_KERNEL);
473 if (f == NULL)
474 goto errout;
475
476 err = route4_set_parms(tp, base, f, handle, head, tb,
477 tca[TCA_RATE], 1);
478 if (err < 0)
479 goto errout;
480
481reinsert:
482 h = from_hash(f->handle >> 16);
483 for (fp = &f->bkt->ht[h]; (f1=*fp) != NULL; fp = &f1->next)
484 if (f->handle < f1->handle)
485 break;
486
487 f->next = f1;
488 tcf_tree_lock(tp);
489 *fp = f;
490
491 if (old_handle && f->handle != old_handle) {
492 th = to_hash(old_handle);
493 h = from_hash(old_handle >> 16);