* [ROSE] Fix dereference of skb pointer after free.
@ 2006-05-13 11:50 Ralf Baechle DL5RB
2006-05-14 10:25 ` Ralf Baechle DL5RB
0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle DL5RB @ 2006-05-13 11:50 UTC (permalink / raw)
To: linux-hams
If rose_route_frame return success we'll dereference a stale pointer.
Likely this is only going to result in bad statistics for the ROSE
interface.
Testers requested.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
net/rose/rose_dev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: linux-net/net/rose/rose_dev.c
===================================================================
--- linux-net.orig/net/rose/rose_dev.c 2006-05-05 02:46:34.000000000 +0100
+++ linux-net/net/rose/rose_dev.c 2006-05-13 12:42:44.000000000 +0100
@@ -60,6 +60,7 @@ static int rose_rebuild_header(struct sk
struct net_device_stats *stats = netdev_priv(dev);
unsigned char *bp = (unsigned char *)skb->data;
struct sk_buff *skbn;
+ unsigned int len;
#ifdef CONFIG_INET
if (arp_find(bp + 7, skb)) {
@@ -76,6 +77,8 @@ static int rose_rebuild_header(struct sk
kfree_skb(skb);
+ len = skbn->len;
+
if (!rose_route_frame(skbn, NULL)) {
kfree_skb(skbn);
stats->tx_errors++;
@@ -83,7 +86,7 @@ static int rose_rebuild_header(struct sk
}
stats->tx_packets++;
- stats->tx_bytes += skbn->len;
+ stats->tx_bytes += len;
#endif
return 1;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ROSE] Fix dereference of skb pointer after free.
2006-05-13 11:50 [ROSE] Fix dereference of skb pointer after free Ralf Baechle DL5RB
@ 2006-05-14 10:25 ` Ralf Baechle DL5RB
0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle DL5RB @ 2006-05-14 10:25 UTC (permalink / raw)
To: linux-hams
Please don't use the previous patch; it's broken. Here's the right one.
Ralf
[NETROM] Fix possible null pointer dereference.
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-05-14 11:09:19.000000000 +0100
+++ linux-net/net/netrom/nr_route.c 2006-05-14 11:10:46.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] 4+ messages in thread
* Re: [ROSE] Fix dereference of skb pointer after free.
2006-06-30 13:36 Ralf Baechle
@ 2006-07-04 2:29 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2006-07-04 2:29 UTC (permalink / raw)
To: ralf; +Cc: netdev
From: Ralf Baechle <ralf@linux-mips.org>
Date: Fri, 30 Jun 2006 14:36:14 +0100
> If rose_route_frame return success we'll dereference a stale pointer.
> Likely this is only going to result in bad statistics for the ROSE
> interface.
>
> This fixes coverity 946.
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Applied, thanks Ralf.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ROSE] Fix dereference of skb pointer after free.
@ 2006-06-30 13:36 Ralf Baechle
2006-07-04 2:29 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2006-06-30 13:36 UTC (permalink / raw)
To: David S. Miller, netdev
If rose_route_frame return success we'll dereference a stale pointer.
Likely this is only going to result in bad statistics for the ROSE
interface.
This fixes coverity 946.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
net/rose/rose_dev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: linux-net/net/rose/rose_dev.c
===================================================================
--- linux-net.orig/net/rose/rose_dev.c 2006-06-23 22:40:27.000000000 +0100
+++ linux-net/net/rose/rose_dev.c 2006-06-23 22:42:56.000000000 +0100
@@ -60,6 +60,7 @@ static int rose_rebuild_header(struct sk
struct net_device_stats *stats = netdev_priv(dev);
unsigned char *bp = (unsigned char *)skb->data;
struct sk_buff *skbn;
+ unsigned int len;
#ifdef CONFIG_INET
if (arp_find(bp + 7, skb)) {
@@ -76,6 +77,8 @@ static int rose_rebuild_header(struct sk
kfree_skb(skb);
+ len = skbn->len;
+
if (!rose_route_frame(skbn, NULL)) {
kfree_skb(skbn);
stats->tx_errors++;
@@ -83,7 +86,7 @@ static int rose_rebuild_header(struct sk
}
stats->tx_packets++;
- stats->tx_bytes += skbn->len;
+ stats->tx_bytes += len;
#endif
return 1;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-07-04 2:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-13 11:50 [ROSE] Fix dereference of skb pointer after free Ralf Baechle DL5RB
2006-05-14 10:25 ` Ralf Baechle DL5RB
2006-06-30 13:36 Ralf Baechle
2006-07-04 2:29 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.