Fix invalid read of memory in avdtp module
PATCH 1/1 Fix invalid read of memory in avdtp module
Fixed incorrect update of server->sessions GSlist in avdtp_exit. Previosly it was leading to invalid read of memory (l = l->next) (and possible memory leaks) since after invoking avdtp_unref in connection_lost, l pointer was not valid anymore (previously assignment l = l->next was used after invoking connection_lost in for loop).
--- audio/avdtp.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
audio/avdtp.c +7 -1
@@ -3857,9 +3857,15 @@ void avdtp_exit(const bdaddr_t *src)if (!server)return ; -for (l = server->sessions; l; l = l->next) { + l = server->sessions; +while (l) {struct avdtp *session = l->data; + l = l->next; +/* value of l pointer should be updated before invoking +* connection_lost since it internally uses avdtp_unref +* which operates on server->session list as well +*/ connection_lost (session, -ECONNABORTED ); }
Signature · 1 line
1.6.3.3
Johan Hedberg
AppliedHi Rafal,
Quoted 8 lines · Rafal Michalski
Fixed incorrect update of
server->sessionsGSlist inavdtp_exit. Previosly it was leading to invalid read of memory (l =l->next) (and possible memory leaks) since after invokingavdtp_unrefinconnection_lost, l pointer was not valid anymore (previously assignment l =l->nextwas used after invokingconnection_lostin for loop).--- audio/avdtp.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
Applied. Thanks.
Johan