]> git.baikalelectronics.ru Git - kernel.git/commit
vsock: always call vsock_init_tables()
authorCong Wang <xiyou.wangcong@gmail.com>
Tue, 24 Oct 2017 22:30:37 +0000 (15:30 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Oct 2017 08:45:58 +0000 (17:45 +0900)
commit7109344bc785ddb39cb367590a0303f495fd4db4
treee2a603686a2f0957a209cc553055b0364cbed72a
parent74b636ef345073121bbf0383a48c32003a66a6d6
vsock: always call vsock_init_tables()

Although CONFIG_VSOCKETS_DIAG depends on CONFIG_VSOCKETS,
vsock_init_tables() is not always called, it is called only
if other modules call its caller. Therefore if we only
enable CONFIG_VSOCKETS_DIAG, it would crash kernel on uninitialized
vsock_bind_table.

This patch fixes it by moving vsock_init_tables() to its own
module_init().

Fixes: 7dbe66a31575 ("VSOCK: add sock_diag interface")
Reported-by: syzkaller bot
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/vmw_vsock/af_vsock.c