* [PATCH] HSI: ssi_protocol: fix potential resource leak in ssip_pn_open()
@ 2022-09-05 7:48 Jianglei Nie
2022-09-20 15:48 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: Jianglei Nie @ 2022-09-05 7:48 UTC (permalink / raw)
To: sre, kuba; +Cc: linux-kernel, Jianglei Nie
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>
---
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.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] HSI: ssi_protocol: fix potential resource leak in ssip_pn_open()
2022-09-05 7:48 [PATCH] HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() Jianglei Nie
@ 2022-09-20 15:48 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2022-09-20 15:48 UTC (permalink / raw)
To: Jianglei Nie; +Cc: kuba, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]
Hi,
On Mon, Sep 05, 2022 at 03:48:01PM +0800, Jianglei Nie wrote:
> 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>
> ---
> 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");
Thanks, queued.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-20 15:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-05 7:48 [PATCH] HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() Jianglei Nie
2022-09-20 15:48 ` Sebastian Reichel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.