diff options
author | Sharvil Nanavati <sharvil@google.com> | 2016-06-20 19:16:12 -0700 |
---|---|---|
committer | Zach Jang <zachjang@google.com> | 2016-06-22 16:28:31 -0700 |
commit | 472271b153c5dc53c28beac55480a8d8434b2d5c (patch) | |
tree | 9112405a19254acdd7e1b37b4d667135cc0e2764 /audio_a2dp_hw | |
parent | 514139f4b40cbb035bb92f3e24d5a389d75db9e6 (diff) | |
download | android_system_bt-472271b153c5dc53c28beac55480a8d8434b2d5c.tar.gz android_system_bt-472271b153c5dc53c28beac55480a8d8434b2d5c.tar.bz2 android_system_bt-472271b153c5dc53c28beac55480a8d8434b2d5c.zip |
DO NOT MERGE Fix potential DoS caused by delivering signal to BT process
Bug: 28885210
Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360
Conflicts:
btif/co/bta_hh_co.c
btif/src/btif_core.c
Merge conflict resolution of ag/1161415 (referencing ag/1164670)
- Directly into mnc-mr2-release
Diffstat (limited to 'audio_a2dp_hw')
-rw-r--r-- | audio_a2dp_hw/audio_a2dp_hw.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/audio_a2dp_hw/audio_a2dp_hw.c b/audio_a2dp_hw/audio_a2dp_hw.c index 29803366e..a17b01cc1 100644 --- a/audio_a2dp_hw/audio_a2dp_hw.c +++ b/audio_a2dp_hw/audio_a2dp_hw.c @@ -244,7 +244,7 @@ static int skt_read(int fd, void *p, size_t len) ts_log("skt_read recv", len, NULL); - if ((read = recv(fd, p, len, MSG_NOSIGNAL)) == -1) + if ((read = TEMP_FAILURE_RETRY(recv(fd, p, len, MSG_NOSIGNAL))) == -1) { ERROR("write failed with errno=%d\n", errno); return -1; @@ -266,12 +266,12 @@ static int skt_write(int fd, const void *p, size_t len) /* poll for 500 ms */ /* send time out */ - if (poll(&pfd, 1, 500) == 0) + if (TEMP_FAILURE_RETRY(poll(&pfd, 1, 500)) == 0) return 0; ts_log("skt_write", len, NULL); - if ((sent = send(fd, p, len, MSG_NOSIGNAL)) == -1) + if ((sent = TEMP_FAILURE_RETRY(send(fd, p, len, MSG_NOSIGNAL))) == -1) { ERROR("write failed with errno=%d\n", errno); return -1; @@ -302,14 +302,14 @@ static int skt_disconnect(int fd) static int a2dp_ctrl_receive(struct a2dp_stream_common *common, void* buffer, int length) { - int ret = recv(common->ctrl_fd, buffer, length, MSG_NOSIGNAL); + int ret = TEMP_FAILURE_RETRY(recv(common->ctrl_fd, buffer, length, MSG_NOSIGNAL)); if (ret < 0) { ERROR("ack failed (%s)", strerror(errno)); if (errno == EINTR) { /* retry again */ - ret = recv(common->ctrl_fd, buffer, length, MSG_NOSIGNAL); + ret = TEMP_FAILURE_RETRY(recv(common->ctrl_fd, buffer, length, MSG_NOSIGNAL)); if (ret < 0) { ERROR("ack failed (%s)", strerror(errno)); @@ -336,7 +336,7 @@ static int a2dp_command(struct a2dp_stream_common *common, char cmd) DEBUG("A2DP COMMAND %s", dump_a2dp_ctrl_event(cmd)); /* send command */ - if (send(common->ctrl_fd, &cmd, 1, MSG_NOSIGNAL) == -1) + if (TEMP_FAILURE_RETRY(send(common->ctrl_fd, &cmd, 1, MSG_NOSIGNAL)) == -1) { ERROR("cmd failed (%s)", strerror(errno)); skt_disconnect(common->ctrl_fd); @@ -409,13 +409,13 @@ static void a2dp_open_ctrl_path(struct a2dp_stream_common *common) break; ERROR("error : a2dp not ready, wait 250 ms and retry"); - usleep(250000); + TEMP_FAILURE_RETRY(usleep(250000)); skt_disconnect(common->ctrl_fd); common->ctrl_fd = AUDIO_SKT_DISCONNECTED; } /* ctrl channel not ready, wait a bit */ - usleep(250000); + TEMP_FAILURE_RETRY(usleep(250000)); } } @@ -578,7 +578,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, DEBUG("emulate a2dp write delay (%d us)", us_delay); - usleep(us_delay); + TEMP_FAILURE_RETRY(usleep(us_delay)); pthread_mutex_unlock(&out->common.lock); return -1; } @@ -985,7 +985,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, DEBUG("emulate a2dp read delay (%d us)", us_delay); - usleep(us_delay); + TEMP_FAILURE_RETRY(usleep(us_delay)); pthread_mutex_unlock(&in->common.lock); return -1; } @@ -1114,7 +1114,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev, DEBUG("success"); /* Delay to ensure Headset is in proper state when START is initiated from DUT immediately after the connection due to ongoing music playback. */ - usleep(250000); + TEMP_FAILURE_RETRY(usleep(250000)); return 0; err_open: |