Skip to content

Commit

Permalink
wimax: fix oops in wimax_dev_get_by_genl_info() when looking up non-w…
Browse files Browse the repository at this point in the history
…imax iface

When a non-wimax interface is looked up by the stack, a bad pointer is
returned when the looked-up interface is not found in the list (of
registered WiMAX interfaces). This causes an oops in the caller when
trying to use the pointer.

Fix by properly setting the pointer to NULL if we don't exit from the
list_for_each() with a found entry.

Signed-off-by: Inaky Perez-Gonzalez <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Inaky Perez-Gonzalez authored and davem330 committed Feb 13, 2009
1 parent df0bca0 commit 1d7b33f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions net/wimax/id-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@ struct wimax_dev *wimax_dev_get_by_genl_info(
list_for_each_entry(wimax_dev, &wimax_id_table, id_table_node) {
if (wimax_dev->net_dev->ifindex == ifindex) {
dev_hold(wimax_dev->net_dev);
break;
goto found;
}
}
if (wimax_dev == NULL)
d_printf(1, NULL, "wimax: no devices found with ifindex %d\n",
ifindex);
wimax_dev = NULL;
d_printf(1, NULL, "wimax: no devices found with ifindex %d\n",
ifindex);
found:
spin_unlock(&wimax_id_table_lock);
d_fnend(3, NULL, "(info %p ifindex %d) = %p\n",
info, ifindex, wimax_dev);
Expand Down

0 comments on commit 1d7b33f

Please sign in to comment.