Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1015462rwi; Wed, 19 Oct 2022 05:52:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YNEy0e2zIgjb9QbC5/utN07W/WV+2XZmd4aTUf0i2kBmNYJTYu0805tbsZg6x4pelnWIp X-Received: by 2002:a17:907:7d8f:b0:78e:2cba:560f with SMTP id oz15-20020a1709077d8f00b0078e2cba560fmr6652654ejc.173.1666183935465; Wed, 19 Oct 2022 05:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183935; cv=none; d=google.com; s=arc-20160816; b=BVrw00tVOi4jOAO3MM8Z9SgaVtQxJmy/5vQbU0G8t7pqIB45v3ZX2Tbg65fbE1hTdw ir4ZkDxpvsbW5Wssvl9ILsMoRtD5p+Vvq6lT+SKcYj6dGMT12FNA9Cmow+BodF/4JqvA uRiwoT0XtmEuSQgx0XZ5PrjDXBqlr2f5q54FGT0ncEkMvhjLCGPmabSX39RP2EU4XHrh sOViR1SOsoXPRlFSn/3uRioRaTrvE1nXNh0oK+VPsIlz8ESDxde6hfo4mtpkrPM+NPMv YI3Mm/S7vbM8aUkAsrkjDeG6Do7gLse9W8DWYzQkKBQxOlthqkudp2f2lMLdfgjGe5vw h/3A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oE8v8I/OPPmIQvXUBMjTG2uCUa+g4At7jc105F86al0=; b=gz7gxY3wMIHlawHOe4JtDJrQTHxtg94goWgDkXgE+GjD42tN8JkrlTe4NTCkD3y/FT 9stNA0VIeoFtVTTLuJscsCZIQY7wMgg2/a0sQQNaPT0p14hiXqnHl8j999ILuNiq6PVB Btaw4vnGL+oa0jZb9oopQtTQXW3Nw7ayZ4h0yiAndAMLQMpB05qEbE5QX4xEHVocBMBx Kg+EHAXuHh1oh5VXyAnEfnJZLLu1NQt0j+Twvj3P1LV0cqOe10dS6nfQ1K7iTp8yXZUz u4B40TC6wJIoc2bGyArqDMcEImsIn5dA9ur2TRWpe/+zp21Cy9wlnro7pzqtj6CgNWd6 BceA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GKX77W1N; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr21-20020a170906d55500b0073dcb2ec4d2si14008454ejc.889.2022.10.19.05.51.49; Wed, 19 Oct 2022 05:52:15 -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=@linuxfoundation.org header.s=korg header.b=GKX77W1N; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232026AbiJSLxQ (ORCPT + 99 others); Wed, 19 Oct 2022 07:53:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230471AbiJSLwu (ORCPT ); Wed, 19 Oct 2022 07:52:50 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A71A24D26E; Wed, 19 Oct 2022 04:31:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id A2668CE21C2; Wed, 19 Oct 2022 09:14:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BE1CC433D7; Wed, 19 Oct 2022 09:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170864; bh=fSjG4RXvpX46fKNLE6mDdtR1CXfA7oy7Me+/3xuP4Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GKX77W1NPLH1iClqT2yqdCl01XZ+soa03y+WKH1xrGX1Dkv2o5pyY+0y/kkYF8q57 y87yY81xSUjBjWH0KV9D/V7qfMGkGegEt3espi04xYWCGXRONHOqkKkDa48tL0kmkL 5l4D35awjrFeIjNFWDEp66UX+UsGDG+4pTlTurGk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Sebastian Reichel , Sasha Levin Subject: [PATCH 6.0 814/862] HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() Date: Wed, 19 Oct 2022 10:35:01 +0200 Message-Id: <20221019083325.888317761@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jianglei Nie [ Upstream commit b28dbcb379e6a7f80262c2732a57681b1ee548ca ] 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 Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- 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.35.1