]> git.baikalelectronics.ru Git - kernel.git/commit
atm: fix a UAF in lec_arp_clear_vccs()
authorCong Wang <xiyou.wangcong@gmail.com>
Fri, 1 May 2020 18:11:08 +0000 (11:11 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 May 2020 18:59:20 +0000 (11:59 -0700)
commitcb8308ebbe9c62bbbe4e07f35c48591267e5624c
tree4d072dccbc4a89676c4c0b16a27162c9a4cdbe79
parent9375b9ec285c330a680f5a6b782169c750790b1e
atm: fix a UAF in lec_arp_clear_vccs()

Gengming reported a UAF in lec_arp_clear_vccs(),
where we add a vcc socket to an entry in a per-device
list but free the socket without removing it from the
list when vcc->dev is NULL.

We need to call lec_vcc_close() to search and remove
those entries contain the vcc being destroyed. This can
be done by calling vcc->push(vcc, NULL) unconditionally
in vcc_destroy_socket().

Another issue discovered by Gengming's reproducer is
the vcc->dev may point to the static device lecatm_dev,
for which we don't need to register/unregister device,
so we can just check for vcc->dev->ops->owner.

Reported-by: Gengming Liu <l.dmxcsnsbh@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/atm/common.c