projects
/
platform
/
upstream
/
connman.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a7d631e
)
connection: Avoid stale memory access
author
Jukka Rissanen
<jukka.rissanen@linux.intel.com>
Wed, 14 Mar 2012 15:28:54 +0000
(17:28 +0200)
committer
Patrik Flykt
<patrik.flykt@linux.intel.com>
Mon, 19 Mar 2012 11:08:53 +0000
(13:08 +0200)
Get the active gateway pointer only after the gateway hash
has been manipulated by add_gateway(). It is possible that
we are accessing stale pointer otherwise.
src/connection.c
patch
|
blob
|
history
diff --git
a/src/connection.c
b/src/connection.c
index
545b59f
..
e4e21d6
100644
(file)
--- a/
src/connection.c
+++ b/
src/connection.c
@@
-567,11
+567,12
@@
int __connman_connection_gateway_add(struct connman_service *service,
DBG("service %p index %d gateway %s vpn ip %s type %d",
service, index, gateway, peer, type);
- active_gateway = find_active_gateway();
new_gateway = add_gateway(service, index, gateway, type);
if (new_gateway == NULL)
return -EINVAL;
+ active_gateway = find_active_gateway();
+
DBG("active %p index %d new %p", active_gateway,
active_gateway ? active_gateway->index : -1, new_gateway);