2019-05-30 01:20:58

by Gen Zhang

[permalink] [raw]
Subject: [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create()

In tegra_hsp_doorbell_create(), 'db->name' is allocated by
devm_kstrdup_const(). It returns NULL when fails. So 'db->name' should
be checked.

Signed-off-by: Gen Zhang <[email protected]>
Acked-by: Thierry Reding <[email protected]>
---
diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
index 11fc9fd..b613c46 100644
--- a/drivers/mailbox/tegra-hsp.c
+++ b/drivers/mailbox/tegra-hsp.c
@@ -292,6 +292,8 @@ tegra_hsp_doorbell_create(struct tegra_hsp *hsp, const char *name,
db->channel.hsp = hsp;

db->name = devm_kstrdup_const(hsp->dev, name, GFP_KERNEL);
+ if (!db->name)
+ return ERR_PTR(-ENOMEM);
db->master = master;
db->index = index;

---


2019-06-08 16:13:15

by Gen Zhang

[permalink] [raw]
Subject: Re: [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create()

On Thu, May 30, 2019 at 09:19:20AM +0800, Gen Zhang wrote:
> In tegra_hsp_doorbell_create(), 'db->name' is allocated by
> devm_kstrdup_const(). It returns NULL when fails. So 'db->name' should
> be checked.
>
> Signed-off-by: Gen Zhang <[email protected]>
> Acked-by: Thierry Reding <[email protected]>
> ---
> diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
> index 11fc9fd..b613c46 100644
> --- a/drivers/mailbox/tegra-hsp.c
> +++ b/drivers/mailbox/tegra-hsp.c
> @@ -292,6 +292,8 @@ tegra_hsp_doorbell_create(struct tegra_hsp *hsp, const char *name,
> db->channel.hsp = hsp;
>
> db->name = devm_kstrdup_const(hsp->dev, name, GFP_KERNEL);
> + if (!db->name)
> + return ERR_PTR(-ENOMEM);
> db->master = master;
> db->index = index;
>
> ---
Can anyone look into this patch? It's acked by Thierry Reding
<[email protected]>.

Thanks
Gen

2019-06-17 09:24:05

by Gen Zhang

[permalink] [raw]
Subject: Re: [PATCH] tegra-hsp: fix a missing-check bug in tegra_hsp_doorbell_create()

On Sun, Jun 09, 2019 at 12:11:44AM +0800, Gen Zhang wrote:
> On Thu, May 30, 2019 at 09:19:20AM +0800, Gen Zhang wrote:
> > In tegra_hsp_doorbell_create(), 'db->name' is allocated by
> > devm_kstrdup_const(). It returns NULL when fails. So 'db->name' should
> > be checked.
> >
> > Signed-off-by: Gen Zhang <[email protected]>
> > Acked-by: Thierry Reding <[email protected]>
> > ---
> > diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
> > index 11fc9fd..b613c46 100644
> > --- a/drivers/mailbox/tegra-hsp.c
> > +++ b/drivers/mailbox/tegra-hsp.c
> > @@ -292,6 +292,8 @@ tegra_hsp_doorbell_create(struct tegra_hsp *hsp, const char *name,
> > db->channel.hsp = hsp;
> >
> > db->name = devm_kstrdup_const(hsp->dev, name, GFP_KERNEL);
> > + if (!db->name)
> > + return ERR_PTR(-ENOMEM);
> > db->master = master;
> > db->index = index;
> >
> > ---
> Can anyone look into this patch? It's acked by Thierry Reding
> <[email protected]>.
>
> Thanks
> Gen
Could anyone look into this patch? It's not updated for about 20 days.
And I am really on a deadline to get this patch applied.

Thanks
Gen