Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1318289pxa; Fri, 28 Aug 2020 09:22:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQ96HSDKXIRq2CjfX4QdF3NaYOjrHpU4I3YUY/X3wBP8cF9aR88fzMYXBYGkgeR52MiQPG X-Received: by 2002:a05:6402:354:: with SMTP id r20mr2674091edw.153.1598631744675; Fri, 28 Aug 2020 09:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598631744; cv=none; d=google.com; s=arc-20160816; b=loDJHkjFoAm/y7zxoxxeoasDspchuDjmloPlq8rXKRnrs54+RDBscJcbwaVPMek8Ds g44BGRADh5lXLScbXiDtZLsHfxK5SzZcoSA4VQa4uWLerRd0EoV9IuQP8j2qzLHjxqmH HIvq8K7llZG9RxKJH3pN2+UpbV4idNlCvK3jNozizUhOPcobHCpkyAHQqLPDsFsoqH0i NeQkU6GEeD+lsxAoBYJp+/Pf0LUqHfMduwptJg/Pj14LWxFaneb7j/U0+6fVXSlgrwRh +pOO7sZ+15Ubk0chj0kJ6eQaxyeUZnjc9p62L+bUUCU5hY9g8oDL1ZieMXsCkMJPfpCv jpdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=AV3wK53DNjTebV9OJa/AEYQrrdddDiANY5m2Ft03cso=; b=Fov9uzYhVe+qzm8kTA5tilQad3+RiyAIqaLrjAVqhb0Ehlx92qVyqStjAS9uIQIw/p M2oas+8Yb6eWvjQ/mp1cwytZNhjOzITZam47wXEOcZm6tg8rXuQckz8TmkAu87c9WG4S wLJ3gq3I++MQg39OfSMx0SvY3R9LH5l3Xh9GncuQWmVmc9roO1SUBtKGlP0AJ24go0zc enYVQMg9mEWhLFcvnN9EExBKNU3rpY0lVEh3MNQlv3uNwl+1rLcnUVo0yw0EIv/6+tH3 mT1TH0QQTRtkC4nk8XsWoAsxUhLQlZyeKfO0ffG1VyMMWKRGGcbXSOKe/ILxR43ZN8Sv hxlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jzGh9jM3; 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 p14si894409eji.611.2020.08.28.09.21.58; Fri, 28 Aug 2020 09:22:24 -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=jzGh9jM3; 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 S1726929AbgH1QTm (ORCPT + 99 others); Fri, 28 Aug 2020 12:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726033AbgH1QTl (ORCPT ); Fri, 28 Aug 2020 12:19:41 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A253CC061264; Fri, 28 Aug 2020 09:19:39 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id t23so1952155ljc.3; Fri, 28 Aug 2020 09:19:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AV3wK53DNjTebV9OJa/AEYQrrdddDiANY5m2Ft03cso=; b=jzGh9jM37421bOvwZ7NXOEdI9pj5lRvi9hvRilLbf7Vwy4VHfMedDd9x1I/g4r6lJk At83McpcFBCSvwGKZcg2lQDXfXpz2mKdvednT9QC50VHA7tLjOEe9E3MFAAJXE17NPxS 8YG+tRxooGc4KKl/4+8bLTL+YQKnR/5C8G49Lng5Q9fhatqpbyLdVDd/SsVtqMaaRWXz +xinPavIk0AIDbyyMkmevSqTQeA/8O4kJJR18XPJvQLcZTNCZXyTH12vMPG7QKHYfSZU LujPJrfP6rSr2S4oolME6xz+Vm15hmLn67RNRVqW8hfaJsjDTpvYZSFqAxyPO5SeHRXI reEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AV3wK53DNjTebV9OJa/AEYQrrdddDiANY5m2Ft03cso=; b=QoWsWVsoRkr2Uujvlb1xGUyEtaeIQnU5vq78gTNYOkselzU6QZ2vFF6uELmQABZCtz iTosbGgIlHJAbeHANss1YnahjlAhdCXmERL2LMpxoSmpARb+B/TJtLtmlHqrOHITkH5U bCxzKvxnvlP854UWkqCJbtjxrDWIylFi92OFRya7/PQ/Gmn5aSSPHUIe353OnzZH/Mjo wY1brGQoidqgjmVAEmopbZYqYNZZOfTh8de6AJoi1ZCElsziCRwr3iVVPi3oKHacFfM8 fIGpacqCh2Cm7lDLtBvs7TZwkx1ddM9LtAUWzknTpni6URulsAsXL8LgD29tB7ZYCGJG fl9Q== X-Gm-Message-State: AOAM531MtLFiTDcoABMDMo2EWJvm7llxRYrOQb0b7p9IW8t9owi/3gmb Z630o7ghs6TCASHeHPQ9fpBJoY5ozaAZRLICjQ== X-Received: by 2002:a2e:584:: with SMTP id 126mr1153036ljf.413.1598631578090; Fri, 28 Aug 2020 09:19:38 -0700 (PDT) MIME-Version: 1.0 References: <20200826144459.8245-1-madhuparnabhowmik10@gmail.com> <20200828074035.GB942935@kroah.com> In-Reply-To: <20200828074035.GB942935@kroah.com> From: Madhuparna Bhowmik Date: Fri, 28 Aug 2020 21:49:27 +0530 Message-ID: Subject: Re: [PATCH] usb/c67x00/c67x00-drv: Fix Data Race bug To: Greg KH Cc: jacmet@sunsite.dk, linux-usb@vger.kernel.org, Linux Kernel Mailing List , ldv-project@linuxtesting.org, andrianov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 28, 2020 at 1:10 PM Greg KH wrote: > > On Wed, Aug 26, 2020 at 08:14:59PM +0530, madhuparnabhowmik10@gmail.com wrote: > > From: Madhuparna Bhowmik > > > > Currently in c67x00_drv_probe() IRQ is requested before calling > > c67x00_probe_sie() and hence if interrupt happens the reading of certain > > variables in the handler can race with initialization of the variables, > > for e.g. sie->sie_num is written in c67x00_probe_sie() and read in > > c67x00_hcd_irq(). > > Hence, this patch calls c67x00_probe_sie() before requesting IRQ in > > probe. > > > > Found by Linux Driver Verification project (linuxtesting.org). > > > > Signed-off-by: Madhuparna Bhowmik > > --- > > drivers/usb/c67x00/c67x00-drv.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/usb/c67x00/c67x00-drv.c b/drivers/usb/c67x00/c67x00-drv.c > > index 53838e7d4eef..2e816d5ca0eb 100644 > > --- a/drivers/usb/c67x00/c67x00-drv.c > > +++ b/drivers/usb/c67x00/c67x00-drv.c > > @@ -146,6 +146,9 @@ static int c67x00_drv_probe(struct platform_device *pdev) > > c67x00_ll_init(c67x00); > > c67x00_ll_hpi_reg_init(c67x00); > > > > + for (i = 0; i < C67X00_SIES; i++) > > + c67x00_probe_sie(&c67x00->sie[i], c67x00, i); > > + > > ret = request_irq(res2->start, c67x00_irq, 0, pdev->name, c67x00); > > if (ret) { > > dev_err(&pdev->dev, "Cannot claim IRQ\n"); > > @@ -158,9 +161,6 @@ static int c67x00_drv_probe(struct platform_device *pdev) > > goto reset_failed; > > } > > > > - for (i = 0; i < C67X00_SIES; i++) > > - c67x00_probe_sie(&c67x00->sie[i], c67x00, i); > > - > > platform_set_drvdata(pdev, c67x00); > > > > return 0; > > Have you tested this on hardware to verify it works properly? No, I haven't, don't think I have the relevant hardware. It would be great if someone could test this and add a Tested-by tag. Thanks, Madhuparna > > thanks, > > greg k-h