* [PATCH] wimax: fix oops in wimax_dev_get_by_genl_info() when looking up non-wimax iface
@ 2009-02-12 23:04 Inaky Perez-Gonzalez
2009-02-13 1:00 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Inaky Perez-Gonzalez @ 2009-02-12 23:04 UTC (permalink / raw)
To: wimax; +Cc: netdev
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>
---
net/wimax/id-table.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/wimax/id-table.c b/net/wimax/id-table.c
index 5e685f7..72273ab 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(
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);
--
1.5.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wimax: fix oops in wimax_dev_get_by_genl_info() when looking up non-wimax iface
2009-02-12 23:04 [PATCH] wimax: fix oops in wimax_dev_get_by_genl_info() when looking up non-wimax iface Inaky Perez-Gonzalez
@ 2009-02-13 1:00 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-02-13 1:00 UTC (permalink / raw)
To: inaky; +Cc: wimax, netdev
From: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Date: Thu, 12 Feb 2009 15:04:52 -0800
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-13 1:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-12 23:04 [PATCH] wimax: fix oops in wimax_dev_get_by_genl_info() when looking up non-wimax iface Inaky Perez-Gonzalez
2009-02-13 1:00 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).