aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMat Martineau <mathewm@codeaurora.org>2012-05-17 19:20:14 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-04 23:34:02 -0400
commit9dc9affcb776b75f6d3e5d69d6e2a679407854f1 (patch)
tree5ad4812b587ef142760c1b586b4d07717cb69e38
parenta8c5fb1afe0b2661a8be78e340f86e6a627f9b32 (diff)
Bluetooth: Free allocated ERTM SREJ list if init fails
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>
-rw-r--r--net/bluetooth/l2cap_core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 24f144b72a96..078bf805cd97 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2381,7 +2381,11 @@ static inline int l2cap_ertm_init(struct l2cap_chan *chan)
2381 if (err < 0) 2381 if (err < 0)
2382 return err; 2382 return err;
2383 2383
2384 return l2cap_seq_list_init(&chan->retrans_list, chan->remote_tx_win); 2384 err = l2cap_seq_list_init(&chan->retrans_list, chan->remote_tx_win);
2385 if (err < 0)
2386 l2cap_seq_list_free(&chan->srej_list);
2387
2388 return err;
2385} 2389}
2386 2390
2387static inline __u8 l2cap_select_mode(__u8 mode, __u16 remote_feat_mask) 2391static inline __u8 l2cap_select_mode(__u8 mode, __u16 remote_feat_mask)