Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4411684ioa; Wed, 27 Apr 2022 03:20:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPi5W+vKSwjVo/PDfj17Btyou2jytPBXnO0Gx0w5LPoX3shjqoWCFhomp5acUoI3muAEr4 X-Received: by 2002:a17:90b:1d90:b0:1d9:acbb:ab18 with SMTP id pf16-20020a17090b1d9000b001d9acbbab18mr9213959pjb.170.1651054815377; Wed, 27 Apr 2022 03:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651054815; cv=none; d=google.com; s=arc-20160816; b=yujsuWoyYrp22EpRbxeuXQ/M56J3NeT0saiKUpY1kjykRwnk8e8zjr4L18jQmAY+of byTXFMN5jmxfRsrLd9k5CrvU3avqHhk17vJSqZo6Ec6O22ByNUFdnHWeAsld75TyUmq2 ovS7Rbz5JcmQ7HOHlPKwSdyJ0QF/rih4AjA8dQb1eeOXquXgJdTv7mbPQI0m0I8sAWQJ B9Fsp8cJCNx4clQOn/Grd1me8f16zJG3Ksg86oaFWte3wMgeVZAe303KD7z0rtsuvJmS Tvl1cMFIYbu/W2ekV8iWc5X1YmwA2IMTLfnMVhoYnaAo1LJ1U0hgKsSX0AfRJibXEZhq c6AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d5n5yryBPWqdKIXkvRkuQoUWn8OX6OqcqNziTsBED5U=; b=W/nvzSnJ3Jn8mraQsmeQ3nNaRSEO7pmkRvl3vxH3ZmIL4M8rpf8pxbMN8/zNubT3gM WoId0DGHCCuzD4bb1kEX6+PSlDzKdsIyyz4R7Wt6TU8Nu1FAUX0jp5IZ4Bi0woQ3v1nK 6s4lgWwjqlj645iW32yDAIQbgfKn5PS9bgoVy/0ifSem0eJkkYsFbg+YlMtAWcgFaLkN BCaX8jb4s/nHpYgMZdf7i3uWGiPliQTgTheeqUuHcLkwDF3gaMiVUPF74NrYqDJxuoW5 /Xav05g7oO1el1oUzDaOtqKRfd/NaIaKwUmVN2S7izk/L+/jnHwuIIrUurrJGzewKzrM a5GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DpQErN2D; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l13-20020a056a0016cd00b0050a8f87bf96si1142658pfc.293.2022.04.27.03.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:20:15 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DpQErN2D; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9A5693614AB; Wed, 27 Apr 2022 02:39:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345445AbiDZImT (ORCPT + 99 others); Tue, 26 Apr 2022 04:42:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345463AbiDZIei (ORCPT ); Tue, 26 Apr 2022 04:34:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB90C762BC; Tue, 26 Apr 2022 01:27:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 08D31617AE; Tue, 26 Apr 2022 08:27:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1591EC385A4; Tue, 26 Apr 2022 08:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650961645; bh=yx8av04Y5xxLJJnNv+WtjSdUDUvPluHDdTSScXGxX4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DpQErN2DhSeYA6wcJ6KvCvBZiR4SFgjy2gLUn22zwV+uxYOrKeMEZe8tYxrXQaNlk Exow5PpkFamT+kX0LtN18+LxRzUwjGhTeydH1t+akvvmyKYIELgPUFCjtScfJrVNF9 zCD158MiESEYvgRJZx2lDUsjwLe99ITPRR1NMNcQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Damien Le Moal Subject: [PATCH 4.19 29/53] ata: pata_marvell: Check the bmdma_addr beforing reading Date: Tue, 26 Apr 2022 10:21:09 +0200 Message-Id: <20220426081736.502980807@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081735.651926456@linuxfoundation.org> References: <20220426081735.651926456@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zheyu Ma commit aafa9f958342db36c17ac2a7f1b841032c96feb4 upstream. Before detecting the cable type on the dma bar, the driver should check whether the 'bmdma_addr' is zero, which means the adapter does not support DMA, otherwise we will get the following error: [ 5.146634] Bad IO access at port 0x1 (return inb(port)) [ 5.147206] WARNING: CPU: 2 PID: 303 at lib/iomap.c:44 ioread8+0x4a/0x60 [ 5.150856] RIP: 0010:ioread8+0x4a/0x60 [ 5.160238] Call Trace: [ 5.160470] [ 5.160674] marvell_cable_detect+0x6e/0xc0 [pata_marvell] [ 5.161728] ata_eh_recover+0x3520/0x6cc0 [ 5.168075] ata_do_eh+0x49/0x3c0 Signed-off-by: Zheyu Ma Signed-off-by: Damien Le Moal Signed-off-by: Greg Kroah-Hartman --- drivers/ata/pata_marvell.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c @@ -82,6 +82,8 @@ static int marvell_cable_detect(struct a switch(ap->port_no) { case 0: + if (!ap->ioaddr.bmdma_addr) + return ATA_CBL_PATA_UNK; if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1) return ATA_CBL_PATA40; return ATA_CBL_PATA80;