aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2014-08-27 22:02:41 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-29 23:22:43 -0400
commitcc086fcf92996965f0dcf05c6641d65381705266 (patch)
treef8c0f6ddc1da64e55a483d097df168571a560f14 /net/tipc/socket.c
parent574746ddeca959cba407d6b556f96cb580fca8af (diff)
tipc: fix a potential oops
Commit 6c9808ce09f7 ("tipc: remove port_lock") accidentally involves a potential bug: when tipc socket instance(tsk) is not got with given reference number in tipc_sk_get(), tsk is set to NULL. Subsequently we jump to exit label where to decrease socket reference counter pointed by tsk pointer in tipc_sk_put(). However, As now tsk is NULL, oops may happen because of touching a NULL pointer. Signed-off-by: Ying Xue <ying.xue@windriver.com> Acked-by: Erik Hugne <erik.hugne@ericsson.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index d416e83ce069..75275c5cf929 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2118,9 +2118,9 @@ static void tipc_sk_timeout(unsigned long ref)
2118 2118
2119 tsk = tipc_sk_get(ref); 2119 tsk = tipc_sk_get(ref);
2120 if (!tsk) 2120 if (!tsk)
2121 goto exit; 2121 return;
2122 sk = &tsk->sk;
2123 2122
2123 sk = &tsk->sk;
2124 bh_lock_sock(sk); 2124 bh_lock_sock(sk);
2125 if (!tsk->connected) { 2125 if (!tsk->connected) {
2126 bh_unlock_sock(sk); 2126 bh_unlock_sock(sk);