diff options
| author | David S. Miller <davem@nuts.ninka.net> | 2003-04-22 09:14:38 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 2003-04-22 09:14:38 -0700 |
| commit | c1f25dc7c596c44a9b56f7831fbd664cc2848543 (patch) | |
| tree | f1b127767b507ba720a4052a2c8ad24c3dd9906c | |
| parent | 43062f4f0bfdaad3b1955271c8e252c9e5aade05 (diff) | |
[NET]: Do not let GCC reload pointers after NULL checks.
| -rw-r--r-- | net/socket.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/socket.c b/net/socket.c index 76bc02010167..39a558da28ca 100644 --- a/net/socket.c +++ b/net/socket.c @@ -149,10 +149,12 @@ static __inline__ void net_family_bug(int family) int net_family_get(int family) { + struct net_proto_family *prot = net_families[family]; int rc = 1; - if (likely(net_families[family] != NULL)) - rc = try_module_get(net_families[family]->owner); + barrier(); + if (likely(prot != NULL)) + rc = try_module_get(prot->owner); else net_family_bug(family); return rc; @@ -160,8 +162,11 @@ int net_family_get(int family) void net_family_put(int family) { - if (likely(net_families[family] != NULL)) - module_put(net_families[family]->owner); + struct net_proto_family *prot = net_families[family]; + + barrier(); + if (likely(prot != NULL)) + module_put(prot->owner); else net_family_bug(family); } |
