Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp785433pxa; Fri, 21 Aug 2020 23:22:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+HGFHB/XjXJh+dD3TRq5/xg1BWguDqTv6R1qvvIZGUbvI7bWEf17DxcX5ueiqxr2NC+0l X-Received: by 2002:a05:6402:3135:: with SMTP id dd21mr6377703edb.123.1598077347799; Fri, 21 Aug 2020 23:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598077347; cv=none; d=google.com; s=arc-20160816; b=FrV3QNxLGoyCzepPuaRBrK4cv3XqQz8HFMZRCk19lBQg8Nx0jt6OG5ADUj27MfabZN QU7PGYXhd0hsqKY52O0EGs8YelqUkr6Vf1qz2ZY7w8wXv0zZCEYuNKCo5Y8Jgh3P+Qmn 4myzdl+u0CevP4G3Mni/qNPi6mueakTp0nP8B121nbh7yuFmaY8C+WbNv6o0uCYZBREF lfICe11ZmQQchYgJinIxHllFtQPw8OYQVMEkliEwxbrZXEJihDubPMBIiVhKYv7cKsFM K5WF1vk6JwiFVkukPPsMTMK0LIIO1US++Rd7WqHSpSRdR1+NRGCd7kxZclyfeL2Q+RnE PPdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=/vsXxIYoH9IaQYN9SpjWFRYwceGPVmhGBMx9DqjyaCA=; b=ByswW8muxX9zbA5Oivy2J+vQ1BcRkgU19WdKsfMECYZRcFhiNHxRDERqBNDo5nfaEb +MhwXQobJEtTq7P0wfkrkkLcyD9HHxKfllFlG5gxX/OHX3oAf4dT6D769JafP+VMX4N2 kUryqQ4bDchS6FyMasOjeOkXsngnZV1dtTkEhrRMbj573n8p8IcR01egORyuJk3LFmiX aDHG1UO9/NSSvyXUeB6GAwLfhdtfUXl71JjdLJeGSDlUV3bOFMSI4kuu3NmZ5jkbA2Jt uiz1iPXm5j0Zh6qO8HTwhL69EHmzK5s84stpIRz5Fx2P1iPipRH3QAzq6NZAEumsQ4Yi MGJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=L64oCmJw; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si4128670edj.109.2020.08.21.23.22.04; Fri, 21 Aug 2020 23:22:27 -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=pass header.i=@gmail.com header.s=20161025 header.b=L64oCmJw; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727017AbgHVGRd (ORCPT + 99 others); Sat, 22 Aug 2020 02:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725863AbgHVGRc (ORCPT ); Sat, 22 Aug 2020 02:17:32 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58116C061573; Fri, 21 Aug 2020 23:17:32 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id d4so1730586pjx.5; Fri, 21 Aug 2020 23:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/vsXxIYoH9IaQYN9SpjWFRYwceGPVmhGBMx9DqjyaCA=; b=L64oCmJwVTF5reQ8SOLuTTPV5gWEEEMC3h4StMqJ/EiQJARv55oVXDUXfzd+w37xOD +SR4p/LCjf/oTjg7I0kSn3FjUj6ItqeG0NgHsdf6ddPCIL56bA4AICnDxat0uUL7F0Fm owaLo2KopE49AXej+lF9qgFrlzmK88Vl+rporEN0WgZbciioS/Q3KOR8hstjeeKibBfw Ws1Jk7l/rvaMXw0oqiC3lVyM55xzPaOCvhF1ZjSwcJdu00MRWI9Le8JEOlh3Cl9k+qtQ lBry93n7hIk62FDZB6krMEjuiv8YTxK8cuZwTJm8bWvmomWkYjGGC3+YLmEfBpZuMIDw AJeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/vsXxIYoH9IaQYN9SpjWFRYwceGPVmhGBMx9DqjyaCA=; b=sVWikr68DxWX4UAmmJ7EqKuUPdQCsbMsBd+x8CfySyJsjki/JBVuRFUmRVd6HTNj9v 1k9WIMrFo97Gal10tMwd33vqB8WB0Cl0EiYtn3aCZwOAPwYYL3K3aDvtusmVtzUiCaXL nvlBCCQWt7fvTmaX7VZTol738+cU+G9Cu47u5YvP6pOp7D0gUPQYE+uDFf+fD+6ZF6rM H/kHZRzOe72k3DQZmogKy7d4cx/a5SWp8ggWQ01CdR33g7fWc9RFQk7tyRxIrOy6VszZ s6jJyQOp/Hl6PAF1d6QeU+0aaNP23/IorIHDOdckVZkbP3inyVK+bdllSybHefNNoQj8 JhlA== X-Gm-Message-State: AOAM533wLBIQLZKCZEKUWO9PjfgKHp3cmSJMVEtaDWxsl2GSyONdMPeB 2pzb4LG8VCildAKUbGovQ2ns5Wx78A== X-Received: by 2002:a17:90a:17ab:: with SMTP id q40mr5286180pja.28.1598077050740; Fri, 21 Aug 2020 23:17:30 -0700 (PDT) Received: from madhuparna-HP-Notebook ([2402:3a80:cfa:ae3e:f998:8f12:465c:736b]) by smtp.gmail.com with ESMTPSA id t2sm4500370pfb.123.2020.08.21.23.17.27 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Aug 2020 23:17:30 -0700 (PDT) From: Madhuparna Bhowmik X-Google-Original-From: Madhuparna Bhowmik Date: Sat, 22 Aug 2020 11:47:25 +0530 To: Ulf Hansson Cc: madhuparnabhowmik10@gmail.com, Bruce Chang , Harald Welte , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List , ldv-project@linuxtesting.org, andrianov@ispras.ru Subject: Re: [PATCH] drivers: mmc: host: via-sdmmc: Fix data race bug Message-ID: <20200822061725.GA7141@madhuparna-HP-Notebook> References: <20200803072857.8880-1-madhuparnabhowmik10@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 21, 2020 at 02:48:37PM +0200, Ulf Hansson wrote: > On Mon, 3 Aug 2020 at 09:29, wrote: > > > > From: Madhuparna Bhowmik > > > > via_save_pcictrlreg() should be called with host->lock held > > as it writes to pm_pcictrl_reg, otherwise there can be a race > > condition between via_sd_suspend() and via_sdc_card_detect(). > > The same pattern is used in the function via_reset_pcictrl() > > as well, where via_save_pcictrlreg() is called with host->lock > > held. > > > > Found by Linux Driver Verification project (linuxtesting.org). > > > > Signed-off-by: Madhuparna Bhowmik > > This doesn't apply to my mmc tree, can you please rebase and submit a > new version. > Sure, I have rebased it to v5.9-rc1, please have a look. Thanks, Madhuparna > Kind regards > Uffe > > > --- > > drivers/mmc/host/via-sdmmc.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/mmc/host/via-sdmmc.c b/drivers/mmc/host/via-sdmmc.c > > index ef95bce50889..e4d8126cd4e5 100644 > > --- a/drivers/mmc/host/via-sdmmc.c > > +++ b/drivers/mmc/host/via-sdmmc.c > > @@ -1259,11 +1259,14 @@ static void via_init_sdc_pm(struct via_crdr_mmc_host *host) > > static int via_sd_suspend(struct pci_dev *pcidev, pm_message_t state) > > { > > struct via_crdr_mmc_host *host; > > + unsigned long flags; > > > > host = pci_get_drvdata(pcidev); > > > > + spin_lock_irqsave(&host->lock, flags); > > via_save_pcictrlreg(host); > > via_save_sdcreg(host); > > + spin_unlock_irqrestore(&host->lock, flags); > > > > pci_save_state(pcidev); > > pci_enable_wake(pcidev, pci_choose_state(pcidev, state), 0); > > -- > > 2.17.1 > >