Skip to content

Commit a565870

Browse files
Martijn Coenengregkh
authored andcommitted
binder: Set end of SG buffer area properly.
In case the target node requests a security context, the extra_buffers_size is increased with the size of the security context. But, that size is not available for use by regular scatter-gather buffers; make sure the ending of that buffer is marked correctly. Acked-by: Todd Kjos <[email protected]> Fixes: ec74136 ("binder: create node flag to request sender's security context") Signed-off-by: Martijn Coenen <[email protected]> Cc: [email protected] # 5.1+ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 333a210 commit a565870

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/android/binder.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3239,7 +3239,8 @@ static void binder_transaction(struct binder_proc *proc,
32393239
buffer_offset = off_start_offset;
32403240
off_end_offset = off_start_offset + tr->offsets_size;
32413241
sg_buf_offset = ALIGN(off_end_offset, sizeof(void *));
3242-
sg_buf_end_offset = sg_buf_offset + extra_buffers_size;
3242+
sg_buf_end_offset = sg_buf_offset + extra_buffers_size -
3243+
ALIGN(secctx_sz, sizeof(u64));
32433244
off_min = 0;
32443245
for (buffer_offset = off_start_offset; buffer_offset < off_end_offset;
32453246
buffer_offset += sizeof(binder_size_t)) {

0 commit comments

Comments
 (0)