* [NETROM] Fix possible null pointer dereference.
@ 2006-06-23 21:44 Ralf Baechle
2006-06-26 7:05 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ralf Baechle @ 2006-06-23 21:44 UTC (permalink / raw)
To: David S. Miller, netdev
If in nr_link_failed the neighbour list is non-empty but the node list
is empty we'll end dereferencing a in a NULL pointer.
This fixes coverity 362.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
net/netrom/nr_route.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
Index: linux-net/net/netrom/nr_route.c
===================================================================
--- linux-net.orig/net/netrom/nr_route.c 2006-06-23 22:40:27.000000000 +0100
+++ linux-net/net/netrom/nr_route.c 2006-06-23 22:42:52.000000000 +0100
@@ -725,15 +725,17 @@ void nr_link_failed(ax25_cb *ax25, int r
struct nr_node *nr_node = NULL;
spin_lock_bh(&nr_neigh_list_lock);
- nr_neigh_for_each(s, node, &nr_neigh_list)
+ nr_neigh_for_each(s, node, &nr_neigh_list) {
if (s->ax25 == ax25) {
nr_neigh_hold(s);
nr_neigh = s;
break;
}
+ }
spin_unlock_bh(&nr_neigh_list_lock);
- if (nr_neigh == NULL) return;
+ if (nr_neigh == NULL)
+ return;
nr_neigh->ax25 = NULL;
ax25_cb_put(ax25);
@@ -743,11 +745,13 @@ void nr_link_failed(ax25_cb *ax25, int r
return;
}
spin_lock_bh(&nr_node_list_lock);
- nr_node_for_each(nr_node, node, &nr_node_list)
+ nr_node_for_each(nr_node, node, &nr_node_list) {
nr_node_lock(nr_node);
- if (nr_node->which < nr_node->count && nr_node->routes[nr_node->which].neighbour == nr_neigh)
+ if (nr_node->which < nr_node->count &&
+ nr_node->routes[nr_node->which].neighbour == nr_neigh)
nr_node->which++;
nr_node_unlock(nr_node);
+ }
spin_unlock_bh(&nr_node_list_lock);
nr_neigh_put(nr_neigh);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [NETROM] Fix possible null pointer dereference.
2006-06-23 21:44 [NETROM] Fix possible null pointer dereference Ralf Baechle
@ 2006-06-26 7:05 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2006-06-26 7:05 UTC (permalink / raw)
To: ralf; +Cc: netdev
From: Ralf Baechle <ralf@linux-mips.org>
Date: Fri, 23 Jun 2006 22:44:37 +0100
> If in nr_link_failed the neighbour list is non-empty but the node list
> is empty we'll end dereferencing a in a NULL pointer.
>
> This fixes coverity 362.
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Applied, thanks Ralf.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-26 7:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-23 21:44 [NETROM] Fix possible null pointer dereference Ralf Baechle
2006-06-26 7:05 ` 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).