Commit 4fe9e018 authored by Johan Hedberg's avatar Johan Hedberg Committed by Benjamin Cabé
Browse files

drivers: bluetooth: h4: Free RX buffer upon reset

There are cases where reset_rx() is called when rx.buf is set (e.g. when
the buffer was too small to receive the incoming packet). Be sure to free
the buffer, so that it wont get reused for the next packet (which might
require a buffer from a different pool).

Signed-off-by: default avatarJohan Hedberg <johan.hedberg@silabs.com>
parent f25fe598
Loading
Loading
Loading
Loading
+5 −0
Changes for drivers/bluetooth/hci/h4.c: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -193,6 +193,11 @@ static inline void copy_hdr(struct h4_data *h4)

static void reset_rx(struct h4_data *h4)
{
	if (h4->rx.buf) {
		net_buf_unref(h4->rx.buf);
		h4->rx.buf = NULL;
	}

	h4->rx.type = BT_HCI_H4_NONE;
	h4->rx.remaining = 0U;
	h4->rx.have_hdr = false;