Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1988550pxy; Mon, 2 Aug 2021 16:05:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7PY0t7BnMx942nbPt66aA+x+w6CZu7vwQqs7eP1pDasbBFLwp7gDI+nZviHVSYvLUIf6g X-Received: by 2002:a17:906:14d0:: with SMTP id y16mr17723384ejc.248.1627945547486; Mon, 02 Aug 2021 16:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627945547; cv=none; d=google.com; s=arc-20160816; b=0R4CGIvAx7RqmuD3P2q9MAsLRAObKDE8Css8f8lD4haE0Qya/XOueXmp3J2iv2D/6G loZnbSmIsrG+YEN08wq9xmiPrEQw9R7ef34zCxr0DTO4Isj2Cj7GyXMrAFoNTrd85LMx WZUzSiV8E/8PpiV6hO4i4+jwrUrDwj26SkrFtFFUhTBDXUU+KRtOeDgX8Zqx1j//M9WU Llq01bv9BgN/Z7MIcblEMj9wX9ECJvouFEqlLuYsI2hKO8jVSelWTpp/JjvCHDlGPht8 r6FzcODUeow/hGzcv6UcZ1f05Xjnqqdd6obfqaz8jKOjuRuFMNAKSFn7pXLZjyuCOPxw WQHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=+/F6H1SVoDXbJfVxzoeNR/we1SvGGtstduI4cQWqmxg=; b=a7icy9xATSyryAxYQ6HJut8q6NyX6wPUXRTEwCTZAsitdDSEAsZ78giz9px000nLAV RepSqm6A3PF55/nfe/mu4l2WruYPbfpVcjip1UjYXndIUH2a4t+y/deIe21AMpkzbmdZ 9YKAdUaFn9yE1R/7L+BOh0LSRrt49YtEXfXTV1IfMSXz3KkD6V1op2vZGsV/xzKlQpbr 8xGsIlb4+HRE5wlyS0xWCOlGN+jdkqYL97J4piQMUBFRg0UBEYtapN4FdAeRxfDgoKat 1wqXN43uP/zFDBDagMrqDkCt+o+C1TOoC2ZMHzkGzLcDnnKj68rulCuFr698LBLXy9ZO 7Q3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BTIvf1s1; 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 e14si11448435ejm.65.2021.08.02.16.05.24; Mon, 02 Aug 2021 16:05:47 -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=BTIvf1s1; 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 S232514AbhHBXD3 (ORCPT + 99 others); Mon, 2 Aug 2021 19:03:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231126AbhHBXD3 (ORCPT ); Mon, 2 Aug 2021 19:03:29 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A253C06175F; Mon, 2 Aug 2021 16:03:18 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id j2so23162451wrx.9; Mon, 02 Aug 2021 16:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=+/F6H1SVoDXbJfVxzoeNR/we1SvGGtstduI4cQWqmxg=; b=BTIvf1s1WiMh1a1qIv0GtWEpsvS+jiefT2b3Iw/5TC1Wt2eoXn9F4sy+hP32n2mVkx 1wlf1H+Muh4pzTamgex3RgjWHf6hS4egDQER1ngarXUYMipckeE+Ys03J4sUKgM8EC+F +oXbXHfF2TjoSVa/fsMcUedgT+A4ve96+L7PoCHQ0t7JVpBCQPmKMANqlsTHVCudfBAv oVLN+pN1GGpCVxTd1cmUyiF8YnOMjxTj3xlLJeXqHY+s+Ey4el7hRuqcwf3qNwYBALy4 7nHRZ8VZ/uYtV7JnHyXzCIcQgUk4KkrajJveTpySkMRy9+ZQN5/oe6eCQ57XvL1K1xPS eYpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=+/F6H1SVoDXbJfVxzoeNR/we1SvGGtstduI4cQWqmxg=; b=o4pvZCYASRQ3//uDU/MEMff7uB4PwtmWJ4Z0lBi37LBfU3xMQE0QN3JlIZrjSxVciM KYPDwaBROZ3W46NJ6HUjLCE96vg9/AqeM8DweIEqSk5r8WCFjz3zO5BIHlgvdFhS5r89 NOsiiZyKzqgZSnyd80sfv9Urz3oQPlFWoDF/AORsLKy1evWEQ3M0zXa1s3OTO10DzPZt z4pK/01yWCJ+51ZWpLIVZOBDA0BBCoKj0yud3jhpHgZNXCBP5LkxeFpPDYfJvpt/ZkEn 0+Dvrw7C5biwouH7bDbYNkBQvZ2zD0k/KuSD2ZLJ+7DtSbwSoHyG864YYGiEoQLpwUA2 XCmg== X-Gm-Message-State: AOAM5309pWOdyXj/uCskY9MfsVnhnx/jbkKo8ZGGfKqM1FUYNQ91IyJ5 x/s3OGCtydVSVKK3irv/eA0= X-Received: by 2002:adf:de06:: with SMTP id b6mr19688480wrm.316.1627945396369; Mon, 02 Aug 2021 16:03:16 -0700 (PDT) Received: from pc ([196.235.140.151]) by smtp.gmail.com with ESMTPSA id g138sm14146060wmg.32.2021.08.02.16.03.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 16:03:15 -0700 (PDT) Date: Tue, 3 Aug 2021 00:03:13 +0100 From: Salah Triki To: Alan Stern , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net, linux-kernel@vger.kernel.org Subject: [PATCH] usb: storage: realtek_cr: get lock before calling usb_enable_autosuspend() Message-ID: <20210802230313.GA1480457@pc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Based on the documentation of usb_enable_autosuspend(), the caller must hold udev's device lock. Signed-off-by: Salah Triki --- drivers/usb/storage/realtek_cr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index 3789698d9d3c..6948d6fdad39 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c @@ -918,9 +918,13 @@ static int realtek_cr_autosuspend_setup(struct us_data *us) timer_setup(&chip->rts51x_suspend_timer, rts51x_suspend_timer_fn, 0); fw5895_init(us); + usb_lock_device(us->pusb_dev); + /* enable autosuspend function of the usb device */ usb_enable_autosuspend(us->pusb_dev); + usb_unlock_device(us->pusb_dev); + return 0; } #endif -- 2.25.1