From patchwork Sat Oct 22 07:29:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108937wrr; Sat, 22 Oct 2022 01:46:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Dv6mTcyGhWplhVmDvzn+XT0VET8vehR3zkKoGf4KJS8GFK0lkURX+2s59R8lc5YnAy93l X-Received: by 2002:a05:6402:410:b0:451:ea13:4ed7 with SMTP id q16-20020a056402041000b00451ea134ed7mr22169781edv.262.1666428397927; Sat, 22 Oct 2022 01:46:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428397; cv=none; d=google.com; s=arc-20160816; b=vmtJ+ixB7uu6gPJhNTGaGTTCf8H1pxj3roU5A4yhQ6GYBsUMIZyzox5OMg2wi5AMHb FWr73EVRonT2kojuPtBZ0wkYVLyff1vuOfXBG2eukcXt2hyWSu6Bo2PESjdLdYEeO7zx FJQ+bF0Sn5IuA5hAqrvXMBLd2onVtB/Z25xdOjuggvfXe1Gv8L66bvm6cNoqajQlCrJk PZZdbAdSKdoo3pvdufoZJo6xHtUgoVK02Y4dWvIRQ/W5rvCVQgBzCYad5oy3xyI0RPXz RtSBjv/RWq8+5fpapg/YTQvfF/vQkzBoJfApByNEWa0rp1uwrnBHW9wc/vJiMp8X5RHJ bb2Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go11-20020a1709070d8b00b0078ac0d5d03esi19052019ejc.562.2022.10.22.01.46.13; Sat, 22 Oct 2022 01:46:37 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376823753209502?= X-GMAIL-MSGID: =?utf-8?q?1747376823753209502?= 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");