]> git.baikalelectronics.ru Git - kernel.git/commit
rds: Incorrect reference counting in TCP socket creation
authorKa-Cheong Poon <ka-cheong.poon@oracle.com>
Fri, 2 Mar 2018 05:07:18 +0000 (21:07 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Mar 2018 14:40:27 +0000 (09:40 -0500)
commite6ff6ee31e96a1b34e35c31540de3e9bc1203204
tree910036b61425b56e91761802c77dc2ea15357b2a
parentfb2d7eba93007b7795778c637c29ea03172db011
rds: Incorrect reference counting in TCP socket creation

Commit 08d9dacac119 ("rds: tcp: use sock_create_lite() to create the
accept socket") has a reference counting issue in TCP socket creation
when accepting a new connection.  The code uses sock_create_lite() to
create a kernel socket.  But it does not do __module_get() on the
socket owner.  When the connection is shutdown and sock_release() is
called to free the socket, the owner's reference count is decremented
and becomes incorrect.  Note that this bug only shows up when the socket
owner is configured as a kernel module.

v2: Update comments

Fixes: 08d9dacac119 ("rds: tcp: use sock_create_lite() to create the accept socket")
Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/tcp_listen.c