2013-11-07 14:51:38

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH] android/ipc: Fix receiving file descriptors

From: Andrei Emeltchenko <[email protected]>

It does make sense iterate over !NULL controll headers. This fixes
the bug that file descriptors cannot be send over IPC.
---
android/hal-ipc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index 14be69b..e4b0681 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
@@ -373,7 +373,7 @@ int hal_ipc_cmd(uint8_t service_id, uint8_t opcode, uint16_t len, void *param,

*fd = -1;

- for (cmsg = CMSG_FIRSTHDR(&msg); !cmsg;
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg;
cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (cmsg->cmsg_level == SOL_SOCKET
&& cmsg->cmsg_type == SCM_RIGHTS) {
--
1.7.10.4



2013-11-07 15:15:11

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] android/ipc: Fix receiving file descriptors

Hi Andrei,

On Thu, Nov 07, 2013, Andrei Emeltchenko wrote:
> It does make sense iterate over !NULL controll headers. This fixes
> the bug that file descriptors cannot be send over IPC.
> ---
> android/hal-ipc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Applied. Thanks.

Johan