Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3673632ybz; Mon, 4 May 2020 07:36:53 -0700 (PDT) X-Google-Smtp-Source: APiQypK42lS4EQvPL1u7SPVq436rdmc9sKl+OvNO3FqRifsbNHed8rKsKIbGINZa1ZEUOmhycgkN X-Received: by 2002:a17:906:5e50:: with SMTP id b16mr15711119eju.331.1588603013684; Mon, 04 May 2020 07:36:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588603013; cv=none; d=google.com; s=arc-20160816; b=xSnW6/nve5+SUv4sn3xJxK8s+vWpqTfScA+kFCcVHFxy1CGH4ni0vjo9Wgtpuk4pQo CpAUaRReTgSvrMQb7H7cfYyQu8dmpLdxrVVbFSIgQBL9tQJACl7bGU5NtxgO1evyI8CS BBvHCxaH3GJcZv3VZIE/X9IRoFwoE/5dgkHbOxP+TS6AEIPsEEupqSwdHJSykqs2Q+4o g5iqTZPRIa3yCYCv2YSX2+QwyE2O3yj6AAy9YQYEp6f1uv9otm3MwQ9dYCDU3wVzqDU9 PX9wxVKzO/j69MpBRE2oy1QLlp9YpSnwaO/DyH7bIO9x2Izj94z38v5FXQ+yae0UJ2uc mlBg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature; bh=vWmFHzkfv8jS2Mn0X+IL+VWQDo/XxfPk1Hg81BCXLGc=; b=bKTkJHhQPigP44r+mAIHu6G1ROT2wRbd90kG7pXU/uyKIdtd+AKFH3XgMQyUrlHk0F ftD3D+yQGqPYmeV38TCupQhT21oFbhScqkLnmM83CQPR8rnQzPlspultcqpsRiSYo9tL dQoqUu/8KNI8oskxiYfY3WmVTUuRkDVKVYm8TPhTXsK2RWNwsFBkOrXPUOrj6YuHaF3E PP+ttbqbEn4B27jYVtn8II+TlGgQKOVduKm3KmFf/qQiTcoWdXqQCj4UdYzpRY4QbJR2 cOAEVeasdxC4yUO/FN+5VJQyOJd3qxdKyqEpfVGyJCGXs4fhZFnEPMoL50N19nA1fazP My3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="FjGam5R/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cf5si6983642ejb.171.2020.05.04.07.36.30; Mon, 04 May 2020 07:36:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="FjGam5R/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728944AbgEDObb (ORCPT + 99 others); Mon, 4 May 2020 10:31:31 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:61047 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728803AbgEDObb (ORCPT ); Mon, 4 May 2020 10:31:31 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588602690; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=vWmFHzkfv8jS2Mn0X+IL+VWQDo/XxfPk1Hg81BCXLGc=; b=FjGam5R/KDrNW4+rbfwYW+8mKqFA7boUXi9au+NnDrec2plDsR0Mp0XP3G7thYbc3kHLE6nH Gxf/71AjsA0aXXVTF0cTRUx8WiqBnSBfkLVPso4kfyov7K8Q/qMs0rjeAO3EqN6ktOkkIZSA YqNCuhxbqJFnDU8+E4ZGaDBZfdU= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5eb02741.7fc815623928-smtp-out-n05; Mon, 04 May 2020 14:31:29 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 72747C433D2; Mon, 4 May 2020 14:31:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [10.226.58.28] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jhugo) by smtp.codeaurora.org (Postfix) with ESMTPSA id B2A0CC433CB; Mon, 4 May 2020 14:31:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B2A0CC433CB Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=jhugo@codeaurora.org Subject: Re: [PATCH v4 4/8] bus: mhi: core: Read transfer length from an event properly To: Bhaumik Bhatt , mani@kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, hemantk@codeaurora.org References: <1588386725-1165-1-git-send-email-bbhatt@codeaurora.org> <1588386725-1165-5-git-send-email-bbhatt@codeaurora.org> From: Jeffrey Hugo Message-ID: <4e187d13-951d-4833-ea82-577b0e755521@codeaurora.org> Date: Mon, 4 May 2020 08:31:25 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <1588386725-1165-5-git-send-email-bbhatt@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/1/2020 8:32 PM, Bhaumik Bhatt wrote: > From: Hemant Kumar > > When MHI Driver receives an EOT event, it reads xfer_len from the > event in the last TRE. The value is under control of the MHI device > and never validated by Host MHI driver. The value should never be > larger than the real size of the buffer but a malicious device can > set the value 0xFFFF as maximum. This causes driver to memory > overflow (both read or write). Fix this issue by reading minimum of > transfer length from event and the buffer length provided. > > Signed-off-by: Hemant Kumar > Signed-off-by: Bhaumik Bhatt Reviewed-by: Jeffrey Hugo -- Jeffrey Hugo Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.