Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1348314pxv; Fri, 2 Jul 2021 01:17:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdJ4ZUdfOtIefl3Qt82xCYDM10iJrN7/3pV8hv6IvMrlmuMO5V+vN3oTI/9kDny9p1+Tuh X-Received: by 2002:a5e:8208:: with SMTP id l8mr6968iom.197.1625213832948; Fri, 02 Jul 2021 01:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625213832; cv=none; d=google.com; s=arc-20160816; b=N7giyU3RVkBoU0SH18v9/RZTOzv50M9L8jgPbX6mYvVfHudfr5qQuwBaRrv89Y12b5 zbVZj+6Mmh9EuLnYSUTinHL52IJS1l5ah9lqDtZD9xPObklHqA4GrbOVgDWtDw4Q1DBZ vGsJdw/8Ombo7KzYnL0F0zfjBxU3jDH14yGcM7LHaJ4ZpLEtA7bUogRLLjR+Q7eVJlo2 a8h4QllB5z7J0cybuai27HOFENlFD0UK5X4tvho4PQnWM/i0qAW0QtMELZBK4+e8zXFz FP3FFn0NZT1MFvApLVMUY/wSlj/inOvURKtddjMOrgS0kr5ghfoXesjm2WXqY5t3XPF+ MXDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:subject:cc:user-agent:mime-version:date:message-id; bh=3PLMr299Rrt1ueT4eOPF/WJY2qX0dx1EtB3BkdCioeQ=; b=ff7I7SMUPRM2xCnQV/8/4wVjLJOr51+rYoSE9PpLbj9lKVH+nsScDSbk8Ytj0fPbzH /w2TGo6uPuo9tJmTf6Rj0vfNl3xT+Uhh5dVy/DrMl2TSdTVVSqPFZ6o/UfU+oX0e8pfy ceZs64xKkd3EbAOmDM+MMbS/aYOa+6Th65oZbDos/mxhjT8uWqoSQq8BlsEKlbtUimfP wYY3KZVbUGU87xyYV35MR1MEqzRROhg4K617AQSwq1VyOTIF+6AWFe9x0FVKxfI+5/8e fzu/QgZu9RlgrjUq4qnl1D2n7ObxfxO83NNAhX/4woYTWvDzzQoqTx/B+kL08QchpIAG VdJw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si2375181ilm.39.2021.07.02.01.17.01; Fri, 02 Jul 2021 01:17:12 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230257AbhGBISV (ORCPT + 99 others); Fri, 2 Jul 2021 04:18:21 -0400 Received: from lucky1.263xmail.com ([211.157.147.133]:59104 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbhGBISU (ORCPT ); Fri, 2 Jul 2021 04:18:20 -0400 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id 522C7D5B08; Fri, 2 Jul 2021 16:15:41 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 0 X-SPAM-CHECKED: 5 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from [172.16.12.64] (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P5174T139827997558528S1625213740712327_; Fri, 02 Jul 2021 16:15:41 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <10bccc0beac9a78a0800e5cc03c23b92> X-RL-SENDER: shawn.lin@rock-chips.com X-SENDER: lintao@rock-chips.com X-LOGIN-NAME: shawn.lin@rock-chips.com X-FST-TO: arnd@kernel.org X-RCPT-COUNT: 7 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 Message-ID: <69f14b04-2ffe-95e3-c6a2-ee6f2628144a@rock-chips.com> Date: Fri, 2 Jul 2021 16:15:41 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Thunderbird/90.0 Cc: shawn.lin@rock-chips.com, Jernej Skrabec , Adrian Hunter , linux-mmc , Linux Kernel Mailing List , Ulf Hansson Subject: =?UTF-8?Q?Re=3a_=5bPATCH=5d_mmc=3a_warn_for_invalid_SDIO_data_buffe?= =?UTF-8?B?cnPjgJDor7fms6jmhI/vvIzpgq7ku7bnlLFsaW51eC1tbWMtb3duZXJAdmdlci5r?= =?UTF-8?B?ZXJuZWwub3Jn5Luj5Y+R44CR?= To: Arnd Bergmann References: <20210630122057.2795882-1-arnd@kernel.org> <6a5d06db-92af-7df0-2c71-e25bad08ee0c@rock-chips.com> From: Shawn Lin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/7/2 15:03, Arnd Bergmann wrote: > On Fri, Jul 2, 2021 at 3:02 AM Shawn Lin wrote: >> On 2021/6/30 20:20, Arnd Bergmann wrote: >>> From: Arnd Bergmann >>> >>> Jernej Skrabec reported a problem with the cw1200 driver failing on >>> arm64 systems with CONFIG_VMAP_STACK=y. >>> >>> The driver in this case passes a pointer to a stack variable (in vmalloc >>> space) into the sdio layer, which gets translated into an invalid DMA >>> address. >>> >>> Even without CONFIG_VMAP_STACK, the driver is still unreliable, as >>> cache invalidations on the DMA buffer may cause random data corruption >>> in adjacent stack slots. >>> >>> This could be worked around in the SDIO core, but in the discussion we >>> decided that passing a stack variable into SDIO should always be considered >>> a bug, as it is for USB drivers. >>> >>> Change the sdio core to produce a one-time warning for any on-stack >>> (both with and without CONFIG_VMAP_STACK) as well as any vmalloc >>> or module-local address that would have the same translation problem. >> >> This was the previous comment about the same topic. >> Should we check for mmc_io_rw_direct? >> >> https://www.spinics.net/lists/linux-mmc/msg41794.html > > Hi Shawn, > > thank you for remembering that previous discussion, that is a > good question. Looking at the code though, I don't actually > see any part of mmc_io_rw_direct() doing DMA on a caller-provided > buffer. The only thing I see in the code is a 'u8 *out' argument, but > that is just a pointer to a single byte that is set by this function. > I didn't quite get the point we need check out for mmc_io_rw_direct() either. As I thought what Ulf was suggesting was some controllers might use data fifo to get cmd response and get DMA involved? But I don't see a explicit one. > Do you see any other issue with that function, or does that mean > we don't have to change it? > > Arnd > > >