Skip to content

Commit

Permalink
HSI: ssi_protocol: fix potential resource leak in ssip_pn_open()
Browse files Browse the repository at this point in the history
[ Upstream commit b28dbcb ]

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 <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Jianglei Nie authored and Sasha Levin committed Oct 21, 2022
1 parent 81f4c9a commit dc5c855
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/hsi/clients/ssi_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit dc5c855

Please sign in to comment.