Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1868019rwb; Fri, 2 Dec 2022 02:11:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf5CUIhaaI5aoxucD0Z25+wCREoJnquLkc8zTCOlpfpLc/secajqseG3gyy/vTRvS2ht8l1K X-Received: by 2002:a17:906:b34c:b0:7c0:a6d8:6a6b with SMTP id cd12-20020a170906b34c00b007c0a6d86a6bmr8510432ejb.194.1669975888829; Fri, 02 Dec 2022 02:11:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669975888; cv=none; d=google.com; s=arc-20160816; b=qK5dyz1aaEB3or/r9PaW/sURf7VzgCWX14oKdysS5M0rsjnPO6vrISwj197n4zLeIF m4OgIKPtWztPeJOQelKjef+ubwg93ltl/DEzWtHQJv04Fq98T/3yLUINvQgcnEnsOTKo /iTO6vl20X+uzlidO0rtbZA+1zKRTjcRrTZovHQbDjBTPL1LpuFCZRxnc7lmewBznVgf G1YMbvrlNqgmfus2hVJ9pPaye4u072p7W69IusRJI9bZ1CB2fmAqFs4O9qjetQnWNFrX bV8Ogocf2X1V+U+GbEQYaKLbBd6fbIlbIeYTgkoSO4ccIMgCL2nD1LjY8HwRvlt3bk9y CTOA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Z0HPGO5sCDYER8nLUp0b1v0HtrgxMZNE6bVgRCZ1Yeo=; b=NRq6gWoWvL0T15Rq7n/MmM8DHIXxD1ozAe1T6+/Z4QJ0p/w4hjAbmtwXqSWly8KRmr F/kh2FPydkNaVVK4RZ3dyHG3w/yZAymSvdMfakORhf8v8tKlxk0PeQNsuZ4MGKNCtfQk pfCub1A9chMNTMN4bv/m5VwDlgVf6TFxSMjWjAmF+cjiVcalr11awvioFghqt8DQORXn 9uq0TRB3ewo/duztwmC3oRjYkHTGWSvQAOTBTaXdeYDInIXOS551i3uNE4jk5uA/8hGV yFJbxAS2lTpGpF+fnzSmSZ+WJxddda/NDU2DmXQ67jnmk5BNvUxsHvPO+MSvmVfwRRPv ZU6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by12-20020a0564021b0c00b004697a8fd1f7si1720159edb.549.2022.12.02.02.11.08; Fri, 02 Dec 2022 02:11:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232909AbiLBJjP (ORCPT + 83 others); Fri, 2 Dec 2022 04:39:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232937AbiLBJjC (ORCPT ); Fri, 2 Dec 2022 04:39:02 -0500 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 668CAB5D9B for ; Fri, 2 Dec 2022 01:39:01 -0800 (PST) Received: by mail-pf1-f169.google.com with SMTP id c15so4385477pfb.13 for ; Fri, 02 Dec 2022 01:39:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z0HPGO5sCDYER8nLUp0b1v0HtrgxMZNE6bVgRCZ1Yeo=; b=P/qk4oZLqrAsqVK4/jnSl3q8IgbW3j+klplsHe3l81+pvr0S8zC0nRpgD2T0jKBBXw 7XAWNtkwvaQU8pWFh92uCbDuluxJDSffE8D5yOcUrjjRqjuSoZ6W78fMjSju132raAVW pVr3fyYck+tYx/HXajAlMNr3n/GPje5C51ZtlPhJCQ7tMVYGf9C8LQ3Bft7/zFQS2+3O N9WhYQx6+wb1L56GfcwK8kFn/N8oqrWsGnGiZeZDDsbllQm1xdKioFA/AuWNiIUVJU26 vlNExzgSEs9BMCnxrV2XO+c6AVC2aQvkPslqxZ+ZtQ3iZxxQDddCL4UnFIAmB6kBQ/2r yyMw== X-Gm-Message-State: ANoB5pki36Q0rWdSz7OMTBfWOV9LMx9Num3KvnI8syF9dDknbeD/lZez XlK0X7mcPTqyLag/vtQPRrY= X-Received: by 2002:a63:f845:0:b0:478:1187:b58 with SMTP id v5-20020a63f845000000b0047811870b58mr22256887pgj.43.1669973940511; Fri, 02 Dec 2022 01:39:00 -0800 (PST) Received: from redsun91.ssa.fujisawa.hgst.com ([129.253.182.55]) by smtp.gmail.com with ESMTPSA id d15-20020a17090a564f00b001ef8ab65052sm4370881pji.11.2022.12.02.01.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 01:38:59 -0800 (PST) From: Johannes Thumshirn To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Johannes Thumshirn , Zhengchao Shao Subject: [PATCH 1/2] drivers: mcb: fix resource leak in mcb_probe() Date: Fri, 2 Dec 2022 01:38:49 -0800 Message-Id: <9f87de36bfb85158b506cb78c6fc9db3f6a3bad1.1669624063.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS 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 From: Zhengchao Shao When probe hook function failed in mcb_probe(), it doesn't put the device. Compiled test only. Fixes: 7bc364097a89 ("mcb: Acquire reference to device in probe") Signed-off-by: Zhengchao Shao Signed-off-by: Johannes Thumshirn --- drivers/mcb/mcb-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c index 338fc889b357..b8ad4f16b4ac 100644 --- a/drivers/mcb/mcb-core.c +++ b/drivers/mcb/mcb-core.c @@ -71,8 +71,10 @@ static int mcb_probe(struct device *dev) get_device(dev); ret = mdrv->probe(mdev, found_id); - if (ret) + if (ret) { module_put(carrier_mod); + put_device(dev); + } return ret; } -- 2.37.3