Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1051305pxb; Wed, 6 Apr 2022 07:35:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcv3OoMeK457VIsfTWGyCqA1iOTwuXUmxwa1n9wkojPmJXuTwzzm7SLA8WQGkhPGIrfrNP X-Received: by 2002:a63:aa07:0:b0:386:3116:d222 with SMTP id e7-20020a63aa07000000b003863116d222mr7422610pgf.313.1649255709740; Wed, 06 Apr 2022 07:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649255709; cv=none; d=google.com; s=arc-20160816; b=nrDcS5MEy9fmGxpX67aEcUwXUY8PVwRyoErY2oME36mt20yQPFHcvMC2ScIKzn9Ng2 SIGvxxGYljW1li7xBMzjEJnMyADdIAZL8Y0avYwfGMc5X04N0FIhxbKCDwS88tEV6jlI OF3171uFWGBVogJRkoL6L8edw8z00K3MRa3nc8rfLb29dOFESSWUsVnsq1vB75l/86BK admK+kw3VOIaxf2jhCN3hYfUaHTx5qkDMwhXjp99BdWUpFalCK4gmnwQw10Zgn8k62Zf tte3Y36epRAuOygfClB+vmlsNieVxZHFz7kmgJ+pOui4w8925PlL9dgEoPKjNjJOReke QwHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+5TeASqScFwwkP3ga5oGCfohTpgutsvPzGxNFkO13C4=; b=S650nHlB8rqnPW5j29h/EInzc2SiIjWcWjoO/byUr2yA7W4KzvV8ENkFJA0YaVB4Dz O3sEqVfSZ2VkS5EDN/XJUgUKAlp5xmDC0l5jhcxKHDOQtg+ouIcThFkEeCLPSD0cRWdi rywSHN8+3MOII+AybchzArxXPF4E9eLPBI7mLeLJsQvL1x0739vYpS4KNtnhgbvLa1ML 52QFFaMKptaOuXRH5EiY2VbxhLMVqbaLo65KrfV8+gNHvLG1iUh9/YMgEjvrkkIUIS/B nh/006vQMY75S6qMknruxBFgJVjy/hUi47I3sF0TUERqIB89WvAh0LwwMpf42vo/+X3r F7yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dKMdohNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d9-20020a056a0010c900b004fa950150a6si17171069pfu.113.2022.04.06.07.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 07:35:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dKMdohNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5E87B645326; Wed, 6 Apr 2022 05:17:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232747AbiDFMSj (ORCPT + 99 others); Wed, 6 Apr 2022 08:18:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231617AbiDFMQ6 (ORCPT ); Wed, 6 Apr 2022 08:16:58 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8769B820C for ; Wed, 6 Apr 2022 00:57:15 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id 125so1535730pgc.11 for ; Wed, 06 Apr 2022 00:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+5TeASqScFwwkP3ga5oGCfohTpgutsvPzGxNFkO13C4=; b=dKMdohNSUNb1VV4EpSBldV0sxbC2qZcFKgj5JaUcxsPdt0jQu/TBh1EIQDcjqPz3im I6io8uSg1yVclSAioT1LBzSS+4Fmn3XmEknTCM0HKGKAHSsjQE/FLd5s6cSNl6mWVnGd j3GGYE3G8VAJvz0Ji14eQVy51TxNTduEWsFIIYYuICTt2xWtf2U+HsW+i8to+tCUTVAt /SFiOTT/VlLEmCkdw+GTFYdDRRCspkItDeYpigR4kSSHovt9Tr5mEl6ibyp6RfLDzPiR NvDx0xl2wgqVS/FeXCOhhqO7haiZVIzmFkfTG/ArAqvVhNfEe/AkaHLgXQpXxCZzLymV QI9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+5TeASqScFwwkP3ga5oGCfohTpgutsvPzGxNFkO13C4=; b=lxYeFkcLWhDZvlXeBxtrNFySsANieumMMbgVDGcgPDNsPv9nPOenNaYDXeEhPDtEFX P3uNtXE3lws7eUyWJwb6FDKGpDTrADV+CxQFezgiof+9+WA/u4hhFyT2VWSASQ0x/yNN sf32lAGWyBCIv95hNZud13XQFnQlmNOL5ACp4McD55z2+3ts5I+/wSbR1FwqKqYXrHiG Rldl1kxBg+BYOk4psB5EI5NNKiTzSZPKISXjwIMiLGSr0LvvkiqJPRg6Zy9T5JePIDbZ ZMry25505oHl990XLOW4SS56HBBqXF6tZx2JfBNYo42OQhIO/abXb/e8ZUo48hPRkQu/ 0GvQ== X-Gm-Message-State: AOAM531YqlgmkoXePjBEjEyINU/ZsISSl4TrR44TErzghGFJ2dugfkR+ 38lYjrd8118CIEMPwIQHi0H+mb5pVoLP3w== X-Received: by 2002:a65:6e9a:0:b0:382:1804:35c8 with SMTP id bm26-20020a656e9a000000b00382180435c8mr6197058pgb.584.1649231835203; Wed, 06 Apr 2022 00:57:15 -0700 (PDT) Received: from slim.das-security.cn ([103.84.139.52]) by smtp.gmail.com with ESMTPSA id q18-20020aa78432000000b004fb0a5aa2c7sm18922949pfn.183.2022.04.06.00.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 00:57:14 -0700 (PDT) From: Hangyu Hua To: eli.billauer@gmail.com, arnd@arndb.de, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Hangyu Hua Subject: [PATCH] char: xillybus: fix a refcount leak in cleanup_dev() Date: Wed, 6 Apr 2022 15:57:03 +0800 Message-Id: <20220406075703.23464-1-hbh25y@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org usb_get_dev is called in xillyusb_probe. So it is better to call usb_put_dev before xdev is released. Signed-off-by: Hangyu Hua --- drivers/char/xillybus/xillyusb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/char/xillybus/xillyusb.c b/drivers/char/xillybus/xillyusb.c index dc3551796e5e..39bcbfd908b4 100644 --- a/drivers/char/xillybus/xillyusb.c +++ b/drivers/char/xillybus/xillyusb.c @@ -549,6 +549,7 @@ static void cleanup_dev(struct kref *kref) if (xdev->workq) destroy_workqueue(xdev->workq); + usb_put_dev(xdev->udev); kfree(xdev->channels); /* Argument may be NULL, and that's fine */ kfree(xdev); } -- 2.25.1