Skip to content

Commit

Permalink
Only allocate ifindex_map[] slot on device registration
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils Nieuwejaar committed Mar 3, 2020
1 parent cc9d4c0 commit f369bf2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions kernel/pf_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -8404,14 +8404,6 @@ static int ring_notifier(struct notifier_block *this, unsigned long msg, void *d
return NOTIFY_DONE;
}

dev_index = map_ifindex(dev->ifindex);

if(dev_index < 0) {
printk("[PF_RING] %s %s: unable to map interface index %d\n", __FUNCTION__,
dev->name, dev->ifindex);
return NOTIFY_DONE;
}

switch (msg) {
case NETDEV_POST_INIT:
case NETDEV_PRE_UP:
Expand All @@ -8421,6 +8413,13 @@ static int ring_notifier(struct notifier_block *this, unsigned long msg, void *d
case NETDEV_REGISTER:
debug_printk(2, "%s: [REGISTER][ifindex: %u]\n", dev->name, dev->ifindex);

dev_index = map_ifindex(dev->ifindex);
if(dev_index < 0) {
printk("[PF_RING] %s %s: unable to map interface index %d\n", __FUNCTION__,
dev->name, dev->ifindex);
break;
}

/* safety check */
list_for_each_safe(ptr, tmp_ptr, &ring_aware_device_list) {
dev_ptr = list_entry(ptr, pf_ring_device, device_list);
Expand Down

0 comments on commit f369bf2

Please sign in to comment.