[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <D6AEF0F1-FAFF-44A1-B6B4-E037EABA1D61@holtmann.org>
Date: Tue, 26 Feb 2019 09:56:31 +0100
From: Marcel Holtmann <marcel@...tmann.org>
To: Kefeng Wang <wangkefeng.wang@...wei.com>
Cc: "open list:BLUETOOTH DRIVERS" <linux-bluetooth@...r.kernel.org>,
linux-kernel@...r.kernel.org, Jeremy Cline <jcline@...hat.com>,
Johan Hedberg <johan.hedberg@...il.com>,
syzbot+899a33dc0fa0dbaf06a6@...kaller.appspotmail.com
Subject: Re: [PATCH] Bluetooth: hci_ldisc: Postpone HCI_UART_PROTO_READY bit
set in hci_uart_set_proto()
Hi Kefeng,
> task A: task B:
> hci_uart_set_proto flush_to_ldisc
> - p->open(hu) -> h5_open //alloc h5 - receive_buf
> - set_bit HCI_UART_PROTO_READY - tty_port_default_receive_buf
> - hci_uart_register_dev - tty_ldisc_receive_buf
> - hci_uart_tty_receive
> - test_bit HCI_UART_PROTO_READY
> - h5_recv
> - clear_bit HCI_UART_PROTO_READY while() {
> - p->open(hu) -> h5_close //free h5
> - h5_rx_3wire_hdr
> - h5_reset() //use-after-free
> }
>
> It could use ioctl to set hci uart proto, but there is
> a use-after-free issue when hci_uart_register_dev() fail in
> hci_uart_set_proto(), see stack above, fix this by setting
> HCI_UART_PROTO_READY bit only when hci_uart_register_dev()
> return success.
>
> Reported-by: syzbot+899a33dc0fa0dbaf06a6@...kaller.appspotmail.com
> Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
> ---
> drivers/bluetooth/hci_ldisc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Powered by blists - more mailing lists