summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJianglei Nie <niejianglei2021@163.com>2022-09-05 10:48:01 +0300
committerSebastian Reichel <sebastian.reichel@collabora.com>2022-09-20 18:25:51 +0300
commitb28dbcb379e6a7f80262c2732a57681b1ee548ca (patch)
tree2af061bfc43650829710a86156d8fa493610282f
parent551e325bbd3fb8b5a686ac1e6cf76e5641461cf2 (diff)
downloadlinux-b28dbcb379e6a7f80262c2732a57681b1ee548ca.tar.xz
HSI: ssi_protocol: fix potential resource leak in ssip_pn_open()
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>
-rw-r--r--drivers/hsi/clients/ssi_protocol.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index 7aacb19fd1ff..274ad8443f8c 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -930,6 +930,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");