From patchwork Fri Dec 2 09:38:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 28839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp747504wrr; Fri, 2 Dec 2022 02:10:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf44+lRzsCjtiF6oGIQn1/TqiEKVopImYrey4med32obscAvJb0/xGQ0/yN0gZ6Bx0zhI3a+ X-Received: by 2002:a17:906:f857:b0:7c0:85ff:d3ee with SMTP id ks23-20020a170906f85700b007c085ffd3eemr14561233ejb.633.1669975818284; Fri, 02 Dec 2022 02:10:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669975818; cv=none; d=google.com; s=arc-20160816; b=zRs+DaU4zSTLKAE5jw8PG4Wpo9HXL+Wfa24t8/YdUkgxtEef3GeYPCPjwbW1SqHZZT AxjKzfU8ZIOsKg/GDDI6vMx+hq+qNPisaU6LJIEH4ZHEwTEd1gv+jYH92QlcxPoWRYKI v55eFUpQmdza1JF/SHuy/v/1ObbGHAycx+tqRTgfOO7XTm9Mfm4Ef1H4iRtRz0dE1mUL we+fjFBGaWos3PEXjP9XpoWYr8ySsnU5KN3zY4N3Ruv96UQSiKe72MijcjpZq0B/Sype 1cRd81h7PYJ3z/3vhs7kFXMVwZsqNiMhBAmIBSofnHIxyP98LGg7ccC9jxUYCmyzKPyr DqyA== 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 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.09.53; Fri, 02 Dec 2022 02:10:18 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751096563874131621?= X-GMAIL-MSGID: =?utf-8?q?1751096563874131621?= 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; }