Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3804618ybi; Mon, 29 Jul 2019 12:59:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbpWHmHUujnwkXT8hmaKkli8RqUnGBD3yasmD9CKXNmspjuZ4oZtgrbhCfTBwIwgjKtdco X-Received: by 2002:a17:902:f089:: with SMTP id go9mr111362316plb.81.1564430343714; Mon, 29 Jul 2019 12:59:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564430343; cv=none; d=google.com; s=arc-20160816; b=jej+T+f6JDm+5vN6nLU/1rfpb53PrAi9j0hGzbt58a/UXUiIGW5FNVOMqaMJnqWFfA m6OGLiDKxbwCE7x39KS5e8BSIWWq+G4SCXJLnShiwRx293NmDFVxDAEEovhQYIUby+xI asAl45qPr8XxbO+CyZkRnTK3kwAqzkiZB0bqQ+Fcxj7OkNfqi0BgEroKLJ5dHFt+4nDA UqGqrud7rvjk4d9Yhq0JVzzer3TBIePFzjIhw2gkdczH85AWbeFwJCuGE1cmghzo919K cekT6J+6IEFCrJD+vluDfpsl1LdWT1KqXYfSB3cqEnSeBHBnoKxHuJK+pVifJxAuad+t A6Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TFJgfVjz/qHuCsuR/hzHc3U9Zy2QVPyXPLBDAmj66yY=; b=vM2MrEhB9AE1unp/1P/5A8A9ttZajNpXGetPO4zLpfqYZVyn5eCc7LpYG2gTXsoUMo 5Ns6ZpzY52nOUw3fBS8hn6GRhsQ3zTzfidph2OHf7PCGBaFSDpocRCuDBwYDpIWquBzQ GCAPE/recCOmji5IaMbzOuYIJMX3boBVfLQrBB1nmQ+0rmlOyvICz35/1+AErJc2G3Ok I9sLsQYxChT+12hm6o2d3cSVqrl6cMCf6qhcvMDjI4YeWwsA/EMtdan1yOkMtYAmfYWW 9FshTAWIyZT8V81HpcG1DrnP+/nJEKzLvnKL+XI5A18rpZAXzTsmSimIlFDWIL86rWBt VYWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v3+IHtLK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q187si26853994pfb.51.2019.07.29.12.58.49; Mon, 29 Jul 2019 12:59:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v3+IHtLK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404043AbfG2T5e (ORCPT + 99 others); Mon, 29 Jul 2019 15:57:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:47100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404020AbfG2Ty0 (ORCPT ); Mon, 29 Jul 2019 15:54:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 134C82054F; Mon, 29 Jul 2019 19:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564430065; bh=+HbxcW2LTONTYqsfB4l18CKET5zvsNbmTcxRty83vN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v3+IHtLKj9Fj0u7ibIUkqDPfldybPKIvD5iqSrVMSxRGboktH0t8o1RP0bmVwaR9o rCo/ksZWxtLGQ8HcWKURXpiqloOITrXHWlgS+wILWjglYoXaJ8NdDV5pnWkpk8a/St 3q/0VILvjfOfG5jPF6yjt90PmAmK5gAPQH5R8pZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Todd Kjos , Martijn Coenen Subject: [PATCH 5.2 184/215] binder: Set end of SG buffer area properly. Date: Mon, 29 Jul 2019 21:23:00 +0200 Message-Id: <20190729190812.095573430@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martijn Coenen commit a56587065094fd96eb4c2b5ad65571daad32156d upstream. 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 Fixes: ec74136ded79 ("binder: create node flag to request sender's security context") Signed-off-by: Martijn Coenen Cc: stable@vger.kernel.org # 5.1+ Link: https://lore.kernel.org/r/20190709110923.220736-1-maco@android.com Signed-off-by: Greg Kroah-Hartman --- drivers/android/binder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -3239,7 +3239,8 @@ static void binder_transaction(struct bi buffer_offset = off_start_offset; off_end_offset = off_start_offset + tr->offsets_size; sg_buf_offset = ALIGN(off_end_offset, sizeof(void *)); - sg_buf_end_offset = sg_buf_offset + extra_buffers_size; + sg_buf_end_offset = sg_buf_offset + extra_buffers_size - + ALIGN(secctx_sz, sizeof(u64)); off_min = 0; for (buffer_offset = off_start_offset; buffer_offset < off_end_offset; buffer_offset += sizeof(binder_size_t)) {