Skip to content

Commit

Permalink
tipc: fix a potential oops
Browse files Browse the repository at this point in the history
Commit 6c9808c ("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 <[email protected]>
Acked-by: Erik Hugne <[email protected]>
Acked-by: Jon Maloy <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ying-xue authored and davem330 committed Aug 30, 2014
1 parent 574746d commit cc086fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -2118,9 +2118,9 @@ static void tipc_sk_timeout(unsigned long ref)

tsk = tipc_sk_get(ref);
if (!tsk)
goto exit;
sk = &tsk->sk;
return;

sk = &tsk->sk;
bh_lock_sock(sk);
if (!tsk->connected) {
bh_unlock_sock(sk);
Expand Down

0 comments on commit cc086fc

Please sign in to comment.