Skip to content

Commit 4fe9e01

Browse files
jhedbergkartben
authored andcommitted
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: Johan Hedberg <[email protected]>
1 parent f25fe59 commit 4fe9e01

File tree

1 file changed

+5
-0
lines changed
  • drivers/bluetooth/hci

1 file changed

+5
-0
lines changed

drivers/bluetooth/hci/h4.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ static inline void copy_hdr(struct h4_data *h4)
193193

194194
static void reset_rx(struct h4_data *h4)
195195
{
196+
if (h4->rx.buf) {
197+
net_buf_unref(h4->rx.buf);
198+
h4->rx.buf = NULL;
199+
}
200+
196201
h4->rx.type = BT_HCI_H4_NONE;
197202
h4->rx.remaining = 0U;
198203
h4->rx.have_hdr = false;

0 commit comments

Comments
 (0)