Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1903850ybz; Thu, 30 Apr 2020 07:30:32 -0700 (PDT) X-Google-Smtp-Source: APiQypJNCgf1blj0XSIz4tUz3jBbYNSjEF1uOAg9WQXSpwogz6sXAeRzHjIUPWz/i6wtdl8h6MA1 X-Received: by 2002:a17:906:a38f:: with SMTP id k15mr3022292ejz.181.1588257032217; Thu, 30 Apr 2020 07:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588257032; cv=none; d=google.com; s=arc-20160816; b=FpCdw6wPuD4FIm7FMFzYG4BigH2hLkEDoZHxD1ABVPL2rPgSe3SNz8YMO65ZwqFcYu oZCHvywbZW4nrH40qSp9wG4wh001aibTpggfdAUgZ+mZoqYcvLCAPv4qERWCecLwt4Z+ d/ggFOSUdJMQtR3Ad0i5sz29dPrui5uFeVD/s0lbm1MiHAKR5wmDUcgT+2FqbNVC+FBi 1MZXP27K+oM2iRXog8prAfGXq8jYqEtTsEopTFcNl+4Zgd2OBRR45Ym/37tC/mEVW6/T quZ1hHUv7fJL33U7Onz7DkTeUQ/d6wFanjDlcoj9/hJSYh/SOqwd056CYqR/2r5a5FiE Ph+Q== 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=Fd/5mPI1qHN/CeCbJAaZucBzynPo3OCPsoOHlCXQti4=; b=Yod5g0Qkl3j+CNSmPyT9D9oxqIPHe0km8+HpucpWwaDeACvyS0n9jLsPuuIuGYBNe0 XcM2sdZwcVSarJoa9x02gNtdUi73BL+mo9/s6iQQy/dAoDiIurTjSiFOVOQahF7soAtm VHxTC6/gVw03+bSO8ksxDwsqZ483WmrSRT6HMgTIkPI1tUqygr5NGLG9+7/K/XgKPcTL FTY9L5nNokvMiPsck6hIBeSsMQih5CHysODCdHHx3397eU2lWpDOYbXH8E0LVgECbSb8 rQKs1ea4MhvDGuLZcjaabP8Ra4p8LwXuceInR9SZOuFqc7FrdHlDyMaVuGZaZYocwboL vWRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=IGJDxRqz; 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 u1si5636339edf.299.2020.04.30.07.30.05; Thu, 30 Apr 2020 07:30:32 -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=IGJDxRqz; 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 S1727809AbgD3O2c (ORCPT + 99 others); Thu, 30 Apr 2020 10:28:32 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:11206 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727052AbgD3O2c (ORCPT ); Thu, 30 Apr 2020 10:28:32 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588256911; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=Fd/5mPI1qHN/CeCbJAaZucBzynPo3OCPsoOHlCXQti4=; b=IGJDxRqzY1j4+hsxSLbORcbVEGVi8Z14ESqxkWbyeDNjQpOr1uCJnJql6XJ3TIh2FninOW6f 8OmwIVM8pUDHZNuwBEQkGgMGIK5LZ/apLeMr733zeSOnB8aW5hc8SVxxLmswxTjKesPTht29 u/y/TOxnpHwVF79YStBGcVdTgCg= 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 5eaae082.7f42438be998-smtp-out-n02; Thu, 30 Apr 2020 14:28:18 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 4255DC433CB; Thu, 30 Apr 2020 14:28:17 +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 1C426C433D2; Thu, 30 Apr 2020 14:28:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1C426C433D2 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 v3 4/9] 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: <1588193551-31439-1-git-send-email-bbhatt@codeaurora.org> <1588193551-31439-5-git-send-email-bbhatt@codeaurora.org> From: Jeffrey Hugo Message-ID: <05f6a503-3639-b55d-3c22-1c6d1617093c@codeaurora.org> Date: Thu, 30 Apr 2020 08:28:14 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <1588193551-31439-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 4/29/2020 2:52 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.