]> git.hungrycats.org Git - linux/commitdiff
HSI: ssi_protocol: fix potential resource leak in ssip_pn_open()
authorJianglei Nie <niejianglei2021@163.com>
Mon, 5 Sep 2022 07:48:01 +0000 (15:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Oct 2022 07:58:26 +0000 (09:58 +0200)
[ 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 <niejianglei2021@163.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hsi/clients/ssi_protocol.c

index 21f11a5b965b11b97fcebbb384e42a9092927bbd..49ffd808d17ff35b20f026b65e263758335bdbff 100644 (file)
@@ -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");