aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2009-02-12 20:00:20 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-12 20:00:20 -0500
commit1d7b33f77b2d8b0b1ee767e6f8f05cbd9d72cb7c (patch)
tree1ed9c919ee096fa0d97cb283ccb074e40898010d /net
parentdf0bca049d01c0ee94afb7cd5dfd959541e6c8da (diff)
wimax: fix oops in wimax_dev_get_by_genl_info() when looking up non-wimax 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 <inaky@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/wimax/id-table.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/wimax/id-table.c b/net/wimax/id-table.c
index 5e685f7eda90..72273abfcb16 100644
--- a/net/wimax/id-table.c
+++ b/net/wimax/id-table.c
@@ -94,12 +94,13 @@ struct wimax_dev *wimax_dev_get_by_genl_info(
94 list_for_each_entry(wimax_dev, &wimax_id_table, id_table_node) { 94 list_for_each_entry(wimax_dev, &wimax_id_table, id_table_node) {
95 if (wimax_dev->net_dev->ifindex == ifindex) { 95 if (wimax_dev->net_dev->ifindex == ifindex) {
96 dev_hold(wimax_dev->net_dev); 96 dev_hold(wimax_dev->net_dev);
97 break; 97 goto found;
98 } 98 }
99 } 99 }
100 if (wimax_dev == NULL) 100 wimax_dev = NULL;
101 d_printf(1, NULL, "wimax: no devices found with ifindex %d\n", 101 d_printf(1, NULL, "wimax: no devices found with ifindex %d\n",
102 ifindex); 102 ifindex);
103found:
103 spin_unlock(&wimax_id_table_lock); 104 spin_unlock(&wimax_id_table_lock);
104 d_fnend(3, NULL, "(info %p ifindex %d) = %p\n", 105 d_fnend(3, NULL, "(info %p ifindex %d) = %p\n",
105 info, ifindex, wimax_dev); 106 info, ifindex, wimax_dev);