Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp772613ybb; Fri, 3 Apr 2020 11:31:15 -0700 (PDT) X-Google-Smtp-Source: APiQypLRdcZ85BXJ3RyFRhq19Tm+XTTXF5Y/HSfEW6LPe3fpTv8GO88Aj7xTRqUX/NC8BWYnjFae X-Received: by 2002:a9d:6c89:: with SMTP id c9mr7388720otr.337.1585938675407; Fri, 03 Apr 2020 11:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585938675; cv=none; d=google.com; s=arc-20160816; b=QDt6MTjiAbv8pJ5IFgFE6bdtBX5FmfnYCVbCO2tVPa0NT6l3vpU41WGz+vh5t6ZpWL 1bwRiabcnMH4/wnEYo2LBAJ0zXfgaFw/tnyg7Buk54ieN+kg/Wirj91X93n3lHHb05qJ eJjMo4l3hklFjWwyzTV4VTGh0L2KmYE0TGQSGyMIdM/VnTVVErhhGXLwVJGbwC8Zy8cW ZeErYomNmzTlgr81d72nxZxgBLnHbJApmSlLsibU+UtxGdZZ7ykQ/EeH/q9LkLiy6pzc bgOiwTZV/cb3kYu+ieopPVEpH/7hG51iWBE8WLnVAPYqYlHJ+uMl/gkkeAgQupxn0cRa mCuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=XyOcRqHLrPMKWL0+JCToAyCGJJg9Vdkcz8glcxLfQsY=; b=y3tdEX+a3pyj3q9qN/F+y8LT/4l7mOOvBrYX8wZ00rsi+bDyVYt9AXfJhf9+8s8R1K f8HdnWz9bPmydU+7JNO9+y1gwDktA4PBDEhvOsa1KvGMcm9kF2hztdoHluJnGI79myhQ zxKonqnuDCAgEgRlc4pPzIThSPaGZq+iFv94E54ki1AdKREp0mJk3Fm261vanuBTFPyD DtUpJbsxs2/YOio+9nmqzwHtj/I5MKg72Qs5dmi5Wa6Bx1NeTLGWYUEINjGJkJtE/3XH F9oFTDpN41AIxoDBWAV0Z43M/t1CU+nwz+HFLx3FvDya2Bki8ivRRbj/1WafcBKRfclB BtLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ILFYgyub; 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 z29si4673507ood.32.2020.04.03.11.31.02; Fri, 03 Apr 2020 11:31:15 -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=ILFYgyub; 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 S2390991AbgDCSSi (ORCPT + 99 others); Fri, 3 Apr 2020 14:18:38 -0400 Received: from mail-pj1-f65.google.com ([209.85.216.65]:38563 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728268AbgDCSSh (ORCPT ); Fri, 3 Apr 2020 14:18:37 -0400 Received: by mail-pj1-f65.google.com with SMTP id m15so3298385pje.3; Fri, 03 Apr 2020 11:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=XyOcRqHLrPMKWL0+JCToAyCGJJg9Vdkcz8glcxLfQsY=; b=ILFYgyubl8EZk3gAnCfiFTzzgD6EDawXKLLuYpR4xGfNSvpQRhdd2gt6aT1KSee0fi gCeeigsN7dAe4UWcrr4JBXqCqOVm6q5KX2ASNntgXyFgwVBqUYf+NnHBGG8Dob9ZPGOA buqRasH4wFH8/JUfGTVhzq2/RVPmK/YWT2FJEj3Vgxl9B5CorEAWmASlAd6PxeWAGvMS iUtOOJydqkpgYxC3/M2Dld4oqYMMcfkn/yAxSZRnbGaLaWsFe2e10tL2EdrQWVuRwNAo QMxjkkUfgTyBZUlXVYAIbThKxEtPNChSuuWUg06MuxJYxpK1pLIGCgOAieb596eMeca/ RKRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XyOcRqHLrPMKWL0+JCToAyCGJJg9Vdkcz8glcxLfQsY=; b=D4wrF9zPLggbsQI+dzW+kE0MGaXotOzmKt1l7VqGFHAdeCWv1InAhJ9HemaBLYETaw 8QXFVYvrM30ona1YWdMxmLud50VDPEUeFjMV41RIhRogVLmmUjwH0E4HvT41yxgq0pLn Tqohr4GtUpNADGlbTui8ei8s6sQlksjMeECpx5orB6Wg1eyqi8BGxCy8VGu9OQ+cDagh dekuSW/eJbM0G8/adWDKSW1sCfhGfvqhoYZk2RApI3qWGZy9zxyZE6mdG8DoSafAA/l2 qYQ5dX/WWNdLi3keTJCNto2cm8Um3ixm2eGCMP0LNVp8u6g23+c8IQMqKDtzArSk1a9B s0Cw== X-Gm-Message-State: AGi0PuYeNE8zYL7TU2lHqttdqiHKN2/ZVRdCr1YiMWbblyGNzsAqH52K +kPmDvi3hE6LeIFMF7p/08vlPUk= X-Received: by 2002:a17:902:ac8d:: with SMTP id h13mr9142477plr.267.1585937916376; Fri, 03 Apr 2020 11:18:36 -0700 (PDT) Received: from localhost.localdomain ([2402:3a80:d32:bec6:f832:439c:9244:ba33]) by smtp.gmail.com with ESMTPSA id f200sm6322893pfa.177.2020.04.03.11.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 11:18:35 -0700 (PDT) From: madhuparnabhowmik10@gmail.com To: gregkh@linuxfoundation.org, hariprasad.kelam@gmail.com, colin.king@canonical.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org, andrianov@ispras.ru, stern@rowland.harvard.edu, Madhuparna Bhowmik Subject: [PATCH] usb: host: u132-hcd: Remove u132_static_list and list head u132_list Date: Fri, 3 Apr 2020 23:48:16 +0530 Message-Id: <20200403181816.8115-1-madhuparnabhowmik10@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Madhuparna Bhowmik u132_static_list is a global list protected by u132_module_lock. It is read in the u132_hcd_exit() function without holding the lock thus may lead to data race. However, it turns out that this list isn't used for anything useful and thus it is okay to get rid of it. Thus, remove the u132_static_list from u132-hcd module. Also remove struct list_head u132_list from struct u132. Found by Linux Driver Verification project (linuxtesting.org). Suggested-by: Alan Stern Signed-off-by: Madhuparna Bhowmik --- drivers/usb/host/u132-hcd.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index e9209e3e6248..995bc52d2d22 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c @@ -81,7 +81,6 @@ static DECLARE_WAIT_QUEUE_HEAD(u132_hcd_wait); static struct mutex u132_module_lock; static int u132_exiting; static int u132_instances; -static struct list_head u132_static_list; /* * end of the global variables protected by u132_module_lock */ @@ -177,7 +176,6 @@ struct u132_ring { }; struct u132 { struct kref kref; - struct list_head u132_list; struct mutex sw_lock; struct mutex scheduler_lock; struct u132_platform_data *board; @@ -254,7 +252,6 @@ static void u132_hcd_delete(struct kref *kref) struct usb_hcd *hcd = u132_to_hcd(u132); u132->going += 1; mutex_lock(&u132_module_lock); - list_del_init(&u132->u132_list); u132_instances -= 1; mutex_unlock(&u132_module_lock); dev_warn(&u132->platform_dev->dev, "FREEING the hcd=%p and thus the u13" @@ -3089,7 +3086,6 @@ static int u132_probe(struct platform_device *pdev) retval = 0; hcd->rsrc_start = 0; mutex_lock(&u132_module_lock); - list_add_tail(&u132->u132_list, &u132_static_list); u132->sequence_num = ++u132_instances; mutex_unlock(&u132_module_lock); u132_u132_init_kref(u132); @@ -3192,7 +3188,6 @@ static struct platform_driver u132_platform_driver = { static int __init u132_hcd_init(void) { int retval; - INIT_LIST_HEAD(&u132_static_list); u132_instances = 0; u132_exiting = 0; mutex_init(&u132_module_lock); @@ -3213,14 +3208,9 @@ static int __init u132_hcd_init(void) module_init(u132_hcd_init); static void __exit u132_hcd_exit(void) { - struct u132 *u132; - struct u132 *temp; mutex_lock(&u132_module_lock); u132_exiting += 1; mutex_unlock(&u132_module_lock); - list_for_each_entry_safe(u132, temp, &u132_static_list, u132_list) { - platform_device_unregister(u132->platform_dev); - } platform_driver_unregister(&u132_platform_driver); printk(KERN_INFO "u132-hcd driver deregistered\n"); wait_event(u132_hcd_wait, u132_instances == 0); -- 2.17.1