Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3918236rwi; Sat, 22 Oct 2022 02:11:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vweSlUFbA0ipYIkLHe7ivlQLJnDsxv/lk516u4w6KmpdfMtCxOMGBk9y8qa9v1wonEBv4 X-Received: by 2002:a17:902:f681:b0:182:bd2c:26ee with SMTP id l1-20020a170902f68100b00182bd2c26eemr23238359plg.59.1666429874232; Sat, 22 Oct 2022 02:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666429874; cv=none; d=google.com; s=arc-20160816; b=LHsDU7dimInQhnS3dup60ApiyDCKtjzNahA92g8P7Tgt8Z2oceEtrNTcGpGcdXOZWM 4j/H4GfpU7k3SV38nKwxIQeKgE6yC2a9JwqpOSMLthbHPBB51E35u0jvfroXGsgQYlZm O5EOu75Cra8WPkINr/d5pYBABFLAuCpp+hFTGHf5Me6mVsCaQAM9cxfEKJCh+jUZ9hgP AWPeDn3nsSi9DlC07CfGyxq2yReLfKy6iq4EruiEnrw+8Ufvr6BlCmRV/2loKsG81khu EeupWRCvUF3YIXNp5VXq2wC/0+Im+Fujp+820fpvhELy60jsxgRnJdte3p/0KYPGMuSI WirQ== 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=W49N7Iu6d2PvwfM8vxewjt//5O2kFNefT6GRAOPVf5fIcbFywuZmM9Hg5kMYYcqlpt 5xQwrjUtRmPGSg1Re+zQyJtYrLLCnDIEgVR37ZcrQBGilOJto8pCDFcx1c8tfjvK1YwY 4K4G8oeUPaxPLPcvpB4s26FJ9gHPvSoZ7gj6mi9WX443P7dlPFwRXmByi5ez0ySsE8Xa JBybirQVr0NL5zI56zQwuTIDff6eSnCZWTIX2GCNl5clijUEClRZQKskWuIfY6XHi9Qd GRrHdnsnpUgqo+RFkC2m+QZwYB23O/nEaXL8jc04XqX8+ylZ1r8jZ2wZ3s6+PaO67Bi5 B0/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lAeXce0C; 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 a38-20020a056a001d2600b00544e163575bsi32324770pfx.176.2022.10.22.02.11.02; Sat, 22 Oct 2022 02:11:14 -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=lAeXce0C; 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 S234710AbiJVIpt (ORCPT + 99 others); Sat, 22 Oct 2022 04:45:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234861AbiJVInv (ORCPT ); Sat, 22 Oct 2022 04:43:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 322B82EA963; Sat, 22 Oct 2022 01:07:39 -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 ams.source.kernel.org (Postfix) with ESMTPS id 598D2B82E21; Sat, 22 Oct 2022 08:05:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A76D8C433C1; Sat, 22 Oct 2022 08:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425955; bh=fSjG4RXvpX46fKNLE6mDdtR1CXfA7oy7Me+/3xuP4Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lAeXce0CnTyjnWKBMabAn5950XUBzBJN5HO0rri0U/i/r7BhJ3QvilGYaj5oAtUo2 UMQA7cqOZJemRTZlgUomHsxh2olJ5/dTpX8alkdQfwP5l8exr+75eO1FMtb9gk/nK+ DifXB/bk9srExLIa4iCOU5mFZ59Bu8AuLIi1hMxI= 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 5.19 671/717] HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() Date: Sat, 22 Oct 2022 09:29:10 +0200 Message-Id: <20221022072528.112564165@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@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.3 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