Skip to content

Commit

Permalink
Bluetooth: Free allocated ERTM SREJ list if init fails
Browse files Browse the repository at this point in the history
If the ERTM SREJ list is properly allocated but the retransmit list
allocation fails, the SREJ list must be freed before returning from
l2cap_ertm_init.  l2cap_chan_del will not clean up the SREJ list
if l2cap_ertm_init returns a failure code.

Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Mat Martineau authored and Johan Hedberg committed Jun 5, 2012
1 parent a8c5fb1 commit 9dc9aff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2381,7 +2381,11 @@ static inline int l2cap_ertm_init(struct l2cap_chan *chan)
if (err < 0)
return err;

return l2cap_seq_list_init(&chan->retrans_list, chan->remote_tx_win);
err = l2cap_seq_list_init(&chan->retrans_list, chan->remote_tx_win);
if (err < 0)
l2cap_seq_list_free(&chan->srej_list);

return err;
}

static inline __u8 l2cap_select_mode(__u8 mode, __u16 remote_feat_mask)
Expand Down

0 comments on commit 9dc9aff

Please sign in to comment.