Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2824420rwb; Mon, 5 Sep 2022 02:00:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR7aPieua4iFwSveOJlKyJoddpPKXtP86L4hTvHxKWpTuOzxS0OuB1090k/YjFsoY04JtOiq X-Received: by 2002:a17:907:2c5b:b0:741:6b8f:d3ab with SMTP id hf27-20020a1709072c5b00b007416b8fd3abmr26237782ejc.447.1662368449977; Mon, 05 Sep 2022 02:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662368449; cv=none; d=google.com; s=arc-20160816; b=l0WrPmzhz09GRJ1HD0Tw4UrGnt6oaCHXfcJhVR/Bbc37Ak6RkXzZexdequDG0wkwiS PwsbzVjKP9M2L99/BxW7sCMJkxxVljShCL0udwoO2ry6jHpSzSY/xYbp7/xPIcMYq07N djNngsbJkGaxpDpyFEswINJkFgyB94Wm4f+LkkfWS9ZieIB3bHrYejvJkPat7/sk6bcq mApzA5yZy32LNrL792Svxj9CbmXVRj2PEzDg/do+18fVCuJ7GHdIcgxPKs0bDT32VF9R AgIvpIKHsH3fsTM0knbtESu+53Bg6hDbS+2EDG8RkaKMHLQqQ+qifZPLRBlKswC0X23t txlA== 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=KMZ+r4yNZ+3+A+Lv7ylA9VmV3lPspBo1F6/XdxNKy6E=; b=ekm+8grGHP12/KiefEP6fZIymd4LclayCxpwARrW6CWhcSTSL+GBN6dG81hNfXJ3oj b8LCaiHRmYBW2e1+NPif6867DWf7d41ei9M3OkbKbhfY4+X9EQb5HuX3tz4SFdz3WTeB Z+7cTB7inqvEvp90GyFH0TzBHzjkVlIAT6tQLtbSheYw23xfg2zP1i0CJSI6PI48aOFV wPbg1Gc8whbQ8PNPJ8zbAU54b9j5yjgGsdt9BTIpzbdRIOGzCgSNvE9502m21vt376fE 4BqNll3BB43kYOXMMaMe5M2BePdby4ukGGs6mpij1MUbglkOOhJv8Q6JFQjNC/EBAU5y mPaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=cxqql0m5; 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=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a05640225c200b00447fd35d76csi7201965edb.615.2022.09.05.02.00.24; Mon, 05 Sep 2022 02:00:49 -0700 (PDT) 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; dkim=pass header.i=@163.com header.s=s110527 header.b=cxqql0m5; 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=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236609AbiIEHsW (ORCPT + 99 others); Mon, 5 Sep 2022 03:48:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235207AbiIEHsU (ORCPT ); Mon, 5 Sep 2022 03:48:20 -0400 Received: from mail-m975.mail.163.com (mail-m975.mail.163.com [123.126.97.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4B46D399F7 for ; Mon, 5 Sep 2022 00:48:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=KMZ+r 4yNZ+3+A+Lv7ylA9VmV3lPspBo1F6/XdxNKy6E=; b=cxqql0m5RHBoH5R7LbZDq N3qphVre3S8k4vrIOtoX68ONMAQvxQUZADE44cLZF/MjaQf0c5uVND4DGYstW4+c Hl5PCb9kTcgU6sKJ5fSxZCXDXWQjw9p+UDNlCxlxYgfuTEkbZiia9K+HJAx+Wl1z QHfWu5yze2rQ9OurLWgo5E= Received: from localhost.localdomain (unknown [36.112.3.113]) by smtp5 (Coremail) with SMTP id HdxpCgCnwCyzqRVjfhjSZw--.34220S4; Mon, 05 Sep 2022 15:48:11 +0800 (CST) From: Jianglei Nie To: sre@kernel.org, kuba@kernel.org Cc: linux-kernel@vger.kernel.org, Jianglei Nie Subject: [PATCH] HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() Date: Mon, 5 Sep 2022 15:48:01 +0800 Message-Id: <20220905074801.46167-1-niejianglei2021@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: HdxpCgCnwCyzqRVjfhjSZw--.34220S4 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wry8trW7Xw18Jw15CFWfKrg_yoWfuFgEkF y0qFy7WF4UGFnIka4FyrySvrWfCr4v9FZxJF1aqF13J34kZrnrCrnrtrZrAayxZFW0q34F yrn5uw1vyw43WjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRt6wZJUUUUU== X-Originating-IP: [36.112.3.113] X-CM-SenderInfo: xqlhyxxdqjzvrlsqjii6rwjhhfrp/1tbiWxtzjGI0WHHwEwAAsj X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 ssip_pn_open() claims the HSI client's port with hsi_claim_port(). When hsi_register_port_event() gets some error and returns a negetive value, the HSI client's port should be released with hsi_release_port(). Fix it by calling hsi_release_port() when hsi_register_port_event() fails. Signed-off-by: Jianglei Nie --- drivers/hsi/clients/ssi_protocol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c index 21f11a5b965b..49ffd808d17f 100644 --- a/drivers/hsi/clients/ssi_protocol.c +++ b/drivers/hsi/clients/ssi_protocol.c @@ -931,6 +931,7 @@ static int ssip_pn_open(struct net_device *dev) if (err < 0) { dev_err(&cl->device, "Register HSI port event failed (%d)\n", err); + hsi_release_port(cl); return err; } dev_dbg(&cl->device, "Configuring SSI port\n"); -- 2.25.1