Received: by 10.192.165.156 with SMTP id m28csp867314imm; Wed, 11 Apr 2018 08:27:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/9dpP4QqJo7SfxCpmKFzaYyA2NqZUH67vcW7UH4C4C/vyywp67V6UYkjfUXBOsHnUHRAcV X-Received: by 2002:a17:902:228:: with SMTP id 37-v6mr5595944plc.141.1523460457272; Wed, 11 Apr 2018 08:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523460457; cv=none; d=google.com; s=arc-20160816; b=fFKSlRRsZSHSCGjvLYx4NmQDTW1vd+dzz4ReLRWDv3KZgKu/JVuq2Z3FVOMhMHFDrm 8dAOZzi/3/3IfdtFHJrkbOpvvZ2xRq8FQ1o+yiiHb6JJTCUg44GeWbEGM5jgpgQ3WD4I +ZyucAon7UDg57B29SUje2g5i7O1mr4HZCdV3l3YMrfuV30xflTaOw/neI4UixuAcQ2M O8vIaW29D+XzM49qsltYLdASGxZ2Pipoz5dUKIVKCNiTSqGJ5VTzERA4k7GteBOh9Ehy RrjSGRHilguiEHCQFVn2K2PdCetoHNW7aIVvw0E0Dmdwsi0iATjyN0U1yfh22LZvsKpo QLrQ== 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:dkim-signature :arc-authentication-results; bh=eMGjlwulbH3ssIn/O1RCsQeDK2iILDi79nQk4NHMeqE=; b=RKc4wm51VACjSda/Cb3hRB1pGLPL+M0fJNUBByXiKPkLiZviHC4T+LyRhBcn+VV3wy +D4dKuaRL8EFqcmawJg8tq8FISVzdHpWIg8dgjCWIGZEg56NEgcsM0mUL1CfYikJWn8Q fZy8BsoDTCcZ/eOtcc78kblwq4sYAHNfrIH90+6aFLZkpN+fDoT6aAKTEtYG5usc3/fr tHwQODYK0Z150jHKyFa2YyJIRCaz24O95dQCing+eorptew21URD2JE4nQV/UY8pgyBv sRBs2STK8xtCIZd2YLt5F1fTRSPrnvc8wpna872goPUi7Jmiqx/lh1QY9UkvWIwVJ8F1 QWXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TWPYmvoz; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v7si990658pfi.28.2018.04.11.08.27.00; Wed, 11 Apr 2018 08:27:37 -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=@gmail.com header.s=20161025 header.b=TWPYmvoz; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753040AbeDKPYC (ORCPT + 99 others); Wed, 11 Apr 2018 11:24:02 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:42480 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752211AbeDKPYA (ORCPT ); Wed, 11 Apr 2018 11:24:00 -0400 Received: by mail-wr0-f195.google.com with SMTP id s18so2176661wrg.9 for ; Wed, 11 Apr 2018 08:24:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=eMGjlwulbH3ssIn/O1RCsQeDK2iILDi79nQk4NHMeqE=; b=TWPYmvozYWnB6yndL3+6PKvBxcWsQZQR5n95yRvgJ4V1OYfk0KqQH17/UPxmC7+ZSI 4HLnUoIC5FCtKK036kBrTMBBJ0da+JfwWFIqLkfaTGrtEzJJoKPkz8A/LJaDqpp9grRY yFB34gW3LfDgzdXF/7LvZPNcjJwt3S47ZDqdJx3tqOoToPQ2xAK+OitnG3vdC+fywHlE h9Fm+Dp/35iCVAeJ+vqOHjkawETw9GdmaMc8zOxq9fzkFtk8igZjrUOqUdF8E9y2jkr6 832Xzj0kImI0AHov+Yo56cyHB9fHCTd+CfC7QcoCriYS0EufUZ1btiBRE6DlsEadMnLn LSpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=eMGjlwulbH3ssIn/O1RCsQeDK2iILDi79nQk4NHMeqE=; b=hpeLy8/YxgFZJcdOYQpLIFKAu5LI/1kCDSHKmuDW8uFs4VfEO7QbdMKG0nKZZ/c/r9 b1Di+gQ/RSonJoTVibK0CNcKvcDkQ+Xbp5bBDREbTbtbZSwAORtJhlv78tbiZ7+2AIhH ob5utpgKh0ombxPav4kT/n7zZGD+HkChHYmj/WXGKZFVwB+oZ1g+Ym2nFeuY51HMLzWB bzZuucG1yHqpvTqOYUn6sD883e1xcsWdMjljyyjDIweGv5m5iRPyAMe+oihVtgLWW3Xe aY7pQ3E+Ax9LHxOyjAQ3kOsyMMFPVruBnlUAG+bbt4psViGVwBo9JSCEOJ4W5HWNU1MI 7uiA== X-Gm-Message-State: ALQs6tAhzbe/mGUg/hSTatfAav8k140VyVW/rKYi4OPDRCdKgREkeP9x 0CDA2EY/lEkSTQZvOHlC/DB6kqDf X-Received: by 10.223.172.226 with SMTP id o89mr3593099wrc.264.1523460239430; Wed, 11 Apr 2018 08:23:59 -0700 (PDT) Received: from [192.168.1.4] (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id t142sm1603636wmt.12.2018.04.11.08.23.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 08:23:58 -0700 (PDT) Subject: Re: [PATCHv2] mtd: spi-nor: Fix Cadence QSPI page fault kernel panic To: thor.thayer@linux.intel.com, cyrille.pitchen@wedev4u.fr, dwmw2@infradead.org, computersforpeace@gmail.com, boris.brezillon@bootlin.com, richard@nod.at Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org References: <1522073537-27386-1-git-send-email-thor.thayer@linux.intel.com> <0b460613-4ac2-c4d8-429e-248a4742a408@linux.intel.com> From: Marek Vasut Message-ID: Date: Wed, 11 Apr 2018 17:23:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <0b460613-4ac2-c4d8-429e-248a4742a408@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/11/2018 05:17 PM, Thor Thayer wrote: > Hi. Any comments on this patch? None other than Reviewed-by: Marek Vasut sorry for the delay. btw stop top-posting please. > On 03/26/2018 09:12 AM, thor.thayer@linux.intel.com wrote: >> From: Thor Thayer >> >> The current Cadence QSPI driver caused a kernel panic when loading >> a Root Filesystem from QSPI. The problem was caused by reading more >> bytes than needed because the QSPI operated on 4 bytes at a time. >> >> [    7.947754] spi_nor_read[1048]:from 0x037cad74, len 1 [bfe07fff] >> [    7.956247] cqspi_read[910]:offset 0x58502516, buffer=bfe07fff >> [    7.956247] >> [    7.966046] Unable to handle kernel paging request at virtual >> address bfe08002 >> [    7.973239] pgd = eebfc000 >> [    7.975931] [bfe08002] *pgd=2fffb811, *pte=00000000, *ppte=00000000 >> >> Notice above how only 1 byte needed to be read but by reading 4 bytes >> into the end of a mapped page, an unrecoverable page fault occurred. >> >> This patch uses a temporary buffer to hold the 4 bytes read and then >> copies only the bytes required into the buffer. A min() function is >> used to limit the length to prevent buffer overflows. >> >> Request testing of this patch on other platforms. This was tested >> on the Intel Arria10 SoCFPGA DevKit. >> >> Signed-off-by: Thor Thayer [...] -- Best regards, Marek Vasut