From 9aaa38fd3bb2cba0067a23df679cda6483af4102 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Mon, 25 Aug 2014 15:59:51 +0200 Subject: [PATCH] android/health: Shutdown MDL socket when freeing channel PTS expects to close all data channels before sending delete confirmation to peer. FD is passed over IPC to Android Bluetooth application so it needs to be shutdown while freeing channel to avoid races. --- android/health.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/android/health.c b/android/health.c index f49110a85..2c05fb86d 100644 --- a/android/health.c +++ b/android/health.c @@ -162,12 +162,17 @@ static void unref_mdl(struct health_channel *channel) static void free_health_channel(void *data) { struct health_channel *channel = data; + int fd; DBG("channel %p", channel); if (!channel) return; + fd = mcap_mdl_get_fd(channel->mdl); + if (fd >= 0) + shutdown(fd, SHUT_RDWR); + unref_mdl(channel); free(channel); } -- 2.47.3