]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
sctp: not copy sctp_sock pd_lobby in sctp_copy_descendant
authorXin Long <lucien.xin@gmail.com>
Mon, 18 Mar 2019 11:58:29 +0000 (19:58 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Mar 2019 01:23:11 +0000 (18:23 -0700)
commit636d25d557d1073281013c43e4ff4737692da2d4
tree733c26be366cc28285d4828744842dc240e2220a
parent273160ffc6b993c7c91627f5a84799c66dfe4dee
sctp: not copy sctp_sock pd_lobby in sctp_copy_descendant

Now sctp_copy_descendant() copies pd_lobby from old sctp scok to new
sctp sock. If sctp_sock_migrate() returns error, it will panic when
releasing new sock and trying to purge pd_lobby due to the incorrect
pointers in pd_lobby.

  [  120.485116] kasan: CONFIG_KASAN_INLINE enabled
  [  120.486270] kasan: GPF could be caused by NULL-ptr deref or user
  [  120.509901] Call Trace:
  [  120.510443]  sctp_ulpevent_free+0x1e8/0x490 [sctp]
  [  120.511438]  sctp_queue_purge_ulpevents+0x97/0xe0 [sctp]
  [  120.512535]  sctp_close+0x13a/0x700 [sctp]
  [  120.517483]  inet_release+0xdc/0x1c0
  [  120.518215]  __sock_release+0x1d2/0x2a0
  [  120.519025]  sctp_do_peeloff+0x30f/0x3c0 [sctp]

We fix it by not copying sctp_sock pd_lobby in sctp_copy_descendan(),
and skb_queue_head_init() can also be removed in sctp_sock_migrate().

Reported-by: syzbot+85e0b422ff140b03672a@syzkaller.appspotmail.com
Fixes: 89664c623617 ("sctp: sctp_sock_migrate() returns error if sctp_bind_addr_dup() fails")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/socket.c