From patchwork Fri Dec 2 09:38:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 28842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp748139wrr; Fri, 2 Dec 2022 02:11:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf4lKsX/6dYjtR+a+CxFdudt8O3Z02mFhRTG+DROemqLFNEDcoM1Mt5Bq1RsUIU2jKgnFDbc X-Received: by 2002:a05:6402:4504:b0:463:71ef:b9ce with SMTP id ez4-20020a056402450400b0046371efb9cemr53925911edb.75.1669975917513; Fri, 02 Dec 2022 02:11:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669975917; cv=none; d=google.com; s=arc-20160816; b=aW3VhNottPflKKXJ5IgHAT6uXqWqnrvzHHP87hfL7N6oH48mkrahPXmzVIbPIjoouk 8A9mC9qt+BTYPRALh7sEMy8k3VvWZ+FYYctr4Vv0N4i2Xz1qwp5g+CVdOv6eqDEFLZUF uR3zJIXwh9FHj3GDYXKPCn5I4Dcdym5/Jw/4JvIFy+EIfSEfx0pZshUsFKdaE5pZa6a6 gRDxJM0DzJsTdzGE/cxAhUSZHVNTjydFZ1WUzsdcGgn1LWpFhh5kYJxYvwlZy/kHhiRc 6szCM8d1D1gcR+0ZelvCC/Q7RBk3Icy14PgqYMu+gf43VTi8hmBjupwBrGL46GBNQADU giww== 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=OTUvgvzDNVb3Q9BB7bRv2FXaIaCGfv+EeGtlZYfVaoQ=; b=O0fXzTOBgedbDgbglAPaX3G9ZMP0l1qHS2YxCwKkv4/XjTmJm2o26dCCxem++1zkcj AmVc6kzk53TCgr1ripQyPIiz+/SBJzuxx6ZxTrXjEs44RjnVBpsV1j+ghFP2Hn0FzzLd 7v1UtQq8NbzutJHk1Jwa8+ZRZzY4et76huMtV79NrFv2DlEj2slfqM5+MYo8bd+Ca5Lr ONLJvXcncG+4FoKB2f1pDYXXlfQTDfc2JjxvJmw9W/nYZtSTDwv8WuYFCj6+QjdFVCNf VzfNMteESkVFXz5sd6J3g34De6pFuUosqrvB1VL6oL/vAaW8kDSgtp/do8fIMQuxDKWg R+cA== 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 nc2-20020a1709071c0200b007aeb99bbb99si6352783ejc.48.2022.12.02.02.11.34; Fri, 02 Dec 2022 02:11:57 -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 S233067AbiLBJjU (ORCPT + 99 others); Fri, 2 Dec 2022 04:39:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232504AbiLBJjE (ORCPT ); Fri, 2 Dec 2022 04:39:04 -0500 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45C3DB7DDF for ; Fri, 2 Dec 2022 01:39:03 -0800 (PST) Received: by mail-pg1-f173.google.com with SMTP id s196so3958479pgs.3 for ; Fri, 02 Dec 2022 01:39:03 -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=OTUvgvzDNVb3Q9BB7bRv2FXaIaCGfv+EeGtlZYfVaoQ=; b=hMvIFlwlVksw1eDYumOyDAe11st4Yq+ToOip5YnUcW5IwJNugmUb5q4tjItT0aLg/g ZGEZJosDgbqFI6/v6pFNmaUhRn32NHYNdix/RZIExGDNKFOMKkDliczA9U9/xZrxE58K MdWNRAAbO50wdaSO/Qc3XwLAb/0gv/0aBMRLxheLiT7zmcyBZuOrTyiUjfLppMTbguJl VSqVmyVXlkEWjah4ofHrHaRYP0KAxH/Erbri50B5okozhkrwG5x71uPU233dj7gDzpfY YQ1gEdKVDcY91IDBTLS9CXrYWla8a8bSE3TTfst6uss5M45xO9uBMHa9rYL9R+TZlJhd 8DfA== X-Gm-Message-State: ANoB5pkwNl5pX7L3+ZHXSOBshPYbPKnxMAXkMPN2A17HVqbhR9xpkUfR iD0j0t0Zj7LICEN9rLUOwDs= X-Received: by 2002:a05:6a00:3017:b0:56b:ac5c:f3dc with SMTP id ay23-20020a056a00301700b0056bac5cf3dcmr53663510pfb.77.1669973942742; Fri, 02 Dec 2022 01:39:02 -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.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 01:39:01 -0800 (PST) From: Johannes Thumshirn To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Johannes Thumshirn , Yang Yingliang Subject: [PATCH 2/2] mcb: mcb-parse: fix error handing in chameleon_parse_gdd() Date: Fri, 2 Dec 2022 01:38:50 -0800 Message-Id: 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?1751096667656808377?= X-GMAIL-MSGID: =?utf-8?q?1751096667656808377?= From: Yang Yingliang If mcb_device_register() returns error in chameleon_parse_gdd(), the refcount of bus and device name are leaked. Fix this by calling put_device() to give up the reference, so they can be released in mcb_release_dev() and kobject_cleanup(). Fixes: 3764e82e5150 ("drivers: Introduce MEN Chameleon Bus") Signed-off-by: Yang Yingliang Reviewed-by: Johannes Thumshirn Signed-off-by: Johannes Thumshirn --- drivers/mcb/mcb-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mcb/mcb-parse.c b/drivers/mcb/mcb-parse.c index 0266bfddfbe2..aa6938da0db8 100644 --- a/drivers/mcb/mcb-parse.c +++ b/drivers/mcb/mcb-parse.c @@ -108,7 +108,7 @@ static int chameleon_parse_gdd(struct mcb_bus *bus, return 0; err: - mcb_free_dev(mdev); + put_device(&mdev->dev); return ret; }