Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp409887ybt; Wed, 17 Jun 2020 04:21:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx22GfkeucPJPMDb+ROVHKHhEn+iewzD1zGloKY19axO7xj9URVJOu35cUwYN76NkTaBAjj X-Received: by 2002:a05:6402:1d96:: with SMTP id dk22mr7010637edb.258.1592392901076; Wed, 17 Jun 2020 04:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592392901; cv=none; d=google.com; s=arc-20160816; b=Oh/JuHy6zYZfMNUsoum129OM5g4qoam1UKqWGqjQnudyHvGdLo0jjdKYbEj04Bimab /I7B1Q+qo2pDkiZ2u4V8nQrNHDqpoUGEnz1H+SiR4Q1mzbxYeiVARUGq5QJ4GfIMFHrW rI0B+QA7hrF1SXgmkWkG6nPDsQLbbj3xIMphzV4p/vbGCB6l72Rv001YgQBmrJD9fj5L qhKHFBeS4Xdb5xOMa326ZzM7zd4LTRByoEFZ+gfR7SWr9BzCsR/oh9gF47v0XqeqYebA RmyF/fAWigWAJw6Z36DQLBpzxZ1EWBYcipjztVnLMByn8rJHEFnAJq1wPHazHlg+Y+6v G07A== 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:ironport-sdr:ironport-sdr; bh=9sma/8Fqt7/FaBEExhVun3JMdhVtZeKFqT84d4aUagc=; b=C2lXbU8yRSirj7kMaJdrkd5nipA1TK6MOhwxscJtF9KHxmieVwMyyqsjS7C17/8DV1 V1Vq47l7dYce6TLoicZ9fOwFofkLRXMucPnifAeAiQCipc1rj8gFb48KY5T2yzdZFRsc 9bE6xMDld4n6dvUFdvdVY/YD+yBKpRyBFV96KmrzgRH0pC/MShwo1PlgH7co1vhLMxOr hw7WLqWWmeupfRfu/cMcEuypEhJS6VmtAbheMzn7DR1uacOTz44Vy98wwso+OeA+F1QF KQ2vAGBaGQTCG0gR/Iozy1gX5g58ZcTgx8sYOfMcD5hGvuNNVoCB8NbybtRzuYQ/92dR 25aw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o25si12658234eja.361.2020.06.17.04.21.16; Wed, 17 Jun 2020 04:21:41 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726915AbgFQLRQ (ORCPT + 99 others); Wed, 17 Jun 2020 07:17:16 -0400 Received: from mga03.intel.com ([134.134.136.65]:3305 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726271AbgFQLRN (ORCPT ); Wed, 17 Jun 2020 07:17:13 -0400 IronPort-SDR: 2cQ//fR0bK5LvEwzu1Raw+g02ODw0vSpQmj9Q3fmUMy8R2Zd/gmZ4Ip9wUN64OlkX6ELATDn0t +3PvdgAnmD5g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2020 04:17:12 -0700 IronPort-SDR: ZwzoQh8XRnqvgl1o/juzdSHL1P1Do1ViuL+y4pfrxO0BdJvUCb9Td4XuqI2Hiz3Tx4kbSczD3a d2OxDRAazCdg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,522,1583222400"; d="scan'208";a="261710413" Received: from mylly.fi.intel.com (HELO [10.237.72.153]) ([10.237.72.153]) by fmsmga007.fm.intel.com with ESMTP; 17 Jun 2020 04:17:08 -0700 Subject: Re: [PATCH v2] i2c: designware: Only check the first byte for SMBus block read length To: Sultan Alsawaf Cc: aaron.ma@canonical.com, admin@kryma.net, andriy.shevchenko@linux.intel.com, benjamin.tissoires@redhat.com, hdegoede@redhat.com, hn.chen@weidahitech.com, jikos@kernel.org, kai.heng.feng@canonical.com, linux-i2c@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, mika.westerberg@linux.intel.com, vicamo.yang@canonical.com, wsa@kernel.org References: <9782f44e-4e01-4e5d-cc50-ab9e2219085c@linux.intel.com> <20200616154328.2866-1-sultan@kerneltoast.com> From: Jarkko Nikula Message-ID: <791f22ae-e11a-047f-0a29-a9e27782b0fa@linux.intel.com> Date: Wed, 17 Jun 2020 14:08:26 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200616154328.2866-1-sultan@kerneltoast.com> 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 6/16/20 6:43 PM, Sultan Alsawaf wrote: > From: Sultan Alsawaf > > SMBus block reads can be broken because the read function will just skip > over bytes it doesn't like until reaching a byte that conforms to the > length restrictions for block reads. This is problematic when it isn't > known if the incoming payload is indeed a conforming block read. > > According to the SMBus specification, block reads will only send the > payload length in the first byte, so we can fix this by only considering > the first byte in a sequence for block read length purposes. > > Fixes: c3ae106050b9 ("i2c: designware: Implement support for SMBus block read and write") > Signed-off-by: Sultan Alsawaf > --- > drivers/i2c/busses/i2c-designware-master.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > Acked-by: Jarkko Nikula