Skip to content

Commit 7841d55

Browse files
jwrdegoedeholtmann
authored andcommitted
Bluetooth: hci_uart_set_flow_control: Fix NULL deref when using serdev
Fix a NULL pointer deref (hu->tty) when calling hci_uart_set_flow_control on hci_uart-s using serdev. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent c0153b0 commit 7841d55

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/bluetooth/hci_ldisc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <linux/ioctl.h>
4242
#include <linux/skbuff.h>
4343
#include <linux/firmware.h>
44+
#include <linux/serdev.h>
4445

4546
#include <net/bluetooth/bluetooth.h>
4647
#include <net/bluetooth/hci_core.h>
@@ -298,6 +299,12 @@ void hci_uart_set_flow_control(struct hci_uart *hu, bool enable)
298299
unsigned int set = 0;
299300
unsigned int clear = 0;
300301

302+
if (hu->serdev) {
303+
serdev_device_set_flow_control(hu->serdev, !enable);
304+
serdev_device_set_rts(hu->serdev, !enable);
305+
return;
306+
}
307+
301308
if (enable) {
302309
/* Disable hardware flow control */
303310
ktermios = tty->termios;

0 commit comments

Comments
 (0)