From patchwork Thu Nov 10 11:38:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wangshaobo (bobo)" X-Patchwork-Id: 18082 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp94248wru; Thu, 10 Nov 2022 03:47:31 -0800 (PST) X-Google-Smtp-Source: AMsMyM5HhxMogu2dMIbqmsB2T6zqAmR0WLklZy3HEVEbODQ3C6wgcbuC9MnJIvEN92YBO5jn7QPq X-Received: by 2002:a17:906:d930:b0:7ad:b45c:dd7a with SMTP id rn16-20020a170906d93000b007adb45cdd7amr2680967ejb.292.1668080851724; Thu, 10 Nov 2022 03:47:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668080851; cv=none; d=google.com; s=arc-20160816; b=ekeXnYx2dV7bE7KGGU3gAy29hR92AbXaBsjl/s1Cl7SnSr5erlqSWIMVlejMkgc1nd RRulvjijE9MMwWV/V3hCG6yEW8i9ScxQ3ENeOuKsOeho4x0x7nBb/GVnvJEG9dpXNhjz mTp9vbA9wh+cvHGp5ICsI0arRywMLogMt5512XtYS093B0j79oEQBWWPnAbr4+ywUE80 DWAvEZxv95ntr3iGApr2InNu3XGP1aOB8t7PNFVPogWuAVBxXOffXCv9WpGIeG4HZOyk UXBKkZ6XZO0b2g8HDR9jmrtv3ZNe/BvAeWcBVI9w6HR3ntgzIw7elhIdcW5u9hiI5tOI ij0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from; bh=ugK/2ewqMSfV0PrUPG8Nb3lowWCDmUSJRxSRnOhYsvY=; b=KwFl7l0Q/r9/ky9zs8O7uASQydiksU4Xkb+N3ECVTFqm4PnjI85FtBW8RhyidM656S +uF0oKBARtWq3fvMTz3GhjzBwgu5NwYh9sp7o4DCKl2YTuq9rbMBhcUTl6U+ia8RHKN2 FcveCcGhPPySR9+Rd9imQqL4uOv+ymqpTeybLxqX5gYqLbr0wDhp0Yh8BI92fXEk7D1y UuNBGs1lKNSuWhqKQHQ1YUytfFuBOIPyDAluZXzvpnhR7iSZPxGy5DZ/vl0UD8QK8jow ElO5JeSU9CRtqGowzn8fBphp8XIkcrd/N9Qi0AOz+idMqnB1QX+86HPpK6GsUEzAtMpP hysQ== 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v6-20020a1709063bc600b007ad9adabc6bsi12267577ejf.207.2022.11.10.03.47.07; Thu, 10 Nov 2022 03:47:31 -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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230347AbiKJLjr (ORCPT + 99 others); Thu, 10 Nov 2022 06:39:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbiKJLjp (ORCPT ); Thu, 10 Nov 2022 06:39:45 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84E2C17E3A; Thu, 10 Nov 2022 03:39:43 -0800 (PST) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4N7KcN120fzHvpl; Thu, 10 Nov 2022 19:39:16 +0800 (CST) Received: from dggpemm500015.china.huawei.com (7.185.36.181) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 19:39:41 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500015.china.huawei.com (7.185.36.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 19:39:41 +0800 From: Wang ShaoBo CC: , , , , Subject: [PATCH] mISDN: fix misuse of put_device() in mISDN_register_device() Date: Thu, 10 Nov 2022 19:38:23 +0800 Message-ID: <20221110113823.167822-1-bobo.shaobowang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500015.china.huawei.com (7.185.36.181) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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?1749109547417471463?= X-GMAIL-MSGID: =?utf-8?q?1749109547417471463?= We should not release reference by put_device() before calling device_initialize(). Fixes: e7d1d4d9ac0d ("mISDN: fix possible memory leak in mISDN_register_device()") Signed-off-by: Wang ShaoBo --- drivers/isdn/mISDN/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c index 7ea0100f218a..90ee56d07a6e 100644 --- a/drivers/isdn/mISDN/core.c +++ b/drivers/isdn/mISDN/core.c @@ -222,7 +222,7 @@ mISDN_register_device(struct mISDNdevice *dev, err = get_free_devid(); if (err < 0) - goto error1; + return err; dev->id = err; device_initialize(&dev->dev);