Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp175359rwi; Wed, 12 Oct 2022 18:07:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XjX1bBZ+jbIeuNo7xQjzzikP+9H1rjW4noDvJlhKK+LZNoWccFzg8zmysFtUbq2H25yTc X-Received: by 2002:a17:906:58c8:b0:6fe:91d5:18d2 with SMTP id e8-20020a17090658c800b006fe91d518d2mr25150860ejs.190.1665623248565; Wed, 12 Oct 2022 18:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665623248; cv=none; d=google.com; s=arc-20160816; b=IAXYxGxms4lqNHFr+cIY+9xZ898XJAG1RzEg7BdNp5iGv89Wn2J8/3rZwMcgSS16bt lKVe5cMH2Z0gAoVg4KymFmYL28Fy8LXMRZg+2TMpvbU7Zkj2XA9gGxYc0i6+hW4tpoOc hPAARoSeJCxTj+wbLFzpCMs0RxUuBiYT5b20mwMwlD5gA6H3Ty76esNjxJ1dIEq11Hnf XWAUChCX+RVfx0+FIWUig2SeJzSKNWjE7Hui9GTekzNINPdWolyptGEnwHyZGySJldh4 x9RSkbUZt5FT5RzgbY2uWyUDwuMsHZzUxNnngpUx/17aBCjD71HWXkOsOnigAKQFpyYt fWzw== 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 :dkim-signature; bh=oE8v8I/OPPmIQvXUBMjTG2uCUa+g4At7jc105F86al0=; b=n4WxuyyvTe+cP6P7PSkMgRw8Lx1HnaVy1FoOaP+2P1+hg69o3mQyTjlWghqm38MU7b OzKZpjsnh6pkVMuo5miOMXiZ3L0/ObS+xCg7F8Xk3lEIrg9hgcNQRECmwOd+hlc+QpZg 5APBrdR3bB/ZKBqFmn1m1i5qgD/vciuLv8KJ4CVMwk1O3rOF7ruOdCOLDRTh6ujm1w3o IJJ4xv0ovBDME6tMZqXYWMc3BTKrukU+4CazD8zMRx4wahedBxAs6l386LPATSdxpZ77 Xz7i4no4+pKL360h1GceIHbffhyKGSVyI0HSz0p4SC9iFrB1byRcsl+baqEJ+eNjs08G RBlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Qnpa5V1/"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020a056402090a00b00457f31c1a10si19317206edz.584.2022.10.12.18.07.03; Wed, 12 Oct 2022 18:07:28 -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=@kernel.org header.s=k20201202 header.b="Qnpa5V1/"; 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 S229905AbiJMAT5 (ORCPT + 99 others); Wed, 12 Oct 2022 20:19:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229887AbiJMATI (ORCPT ); Wed, 12 Oct 2022 20:19:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFF70E6F78; Wed, 12 Oct 2022 17:17:30 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A0126616CB; Thu, 13 Oct 2022 00:17:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 365C6C433C1; Thu, 13 Oct 2022 00:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665620236; bh=fSjG4RXvpX46fKNLE6mDdtR1CXfA7oy7Me+/3xuP4Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qnpa5V1/2XLZM18qpl2RHuX14Cuyc7ytMQrKD4VG9Dnhsg3MWoumv6JumApa3z8jp cCNQL5Aiq/p9cbvxUpTdFDOC7BUZ6P+ipMAwKfsz0Fkg5/KOGKMQg4/TeOaBIouBNX Ct5eu9831V/s52OdrydyYNGwD1KQvk83dT3IBcv0puFW1lMtelLN8OVAF99O0b71xm VkvwdWuRc6FtOIIjU5x1eF+KABk45r0IZCU9S7qbd9K8vHy+GjAbrdLHBtWTf22Eoa mwLrRymhyW/+h+yrznAFx9le5ZCcnPV584fiQN3oCRPpxSfyYJ65gOTm1fv4xbJ4Ug l6Cs8Cyf878xg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jianglei Nie , Sebastian Reichel , Sasha Levin , sre@kernel.org, wangqing@vivo.com, kuba@kernel.org Subject: [PATCH AUTOSEL 6.0 33/67] HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() Date: Wed, 12 Oct 2022 20:15:14 -0400 Message-Id: <20221013001554.1892206-33-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221013001554.1892206-1-sashal@kernel.org> References: <20221013001554.1892206-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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