All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: ieee802154: mcr20a: do not leak resources on error path
@ 2018-04-12 12:28 Stefan Schmidt
  2018-04-12 12:38 ` Xue Liu
  2018-04-12 13:28 ` Xue Liu
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Schmidt @ 2018-04-12 12:28 UTC (permalink / raw)
  To: Xue Liu, linux-wpan; +Cc: Alexander Aring, Stefan Schmidt

We already allocated the device and platform  data at this
point. Instead of simply return from the probe function we
need to cleanup the resources first.

Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
---
 drivers/net/ieee802154/mcr20a.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
index 944470d69ba9..de0d7f28a181 100644
--- a/drivers/net/ieee802154/mcr20a.c
+++ b/drivers/net/ieee802154/mcr20a.c
@@ -1309,8 +1309,10 @@ mcr20a_probe(struct spi_device *spi)
 	/* init buf */
 	lp->buf = devm_kzalloc(&spi->dev, SPI_COMMAND_BUFFER, GFP_KERNEL);
 
-	if (!lp->buf)
-		return -ENOMEM;
+	if (!lp->buf) {
+		ret = -ENOMEM;
+		goto free_dev;
+	}
 
 	mcr20a_setup_tx_spi_messages(lp);
 	mcr20a_setup_rx_spi_messages(lp);
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: ieee802154: mcr20a: do not leak resources on error path
  2018-04-12 12:28 [PATCH] net: ieee802154: mcr20a: do not leak resources on error path Stefan Schmidt
@ 2018-04-12 12:38 ` Xue Liu
  2018-04-12 13:23   ` Stefan Schmidt
  2018-04-12 13:28 ` Xue Liu
  1 sibling, 1 reply; 6+ messages in thread
From: Xue Liu @ 2018-04-12 12:38 UTC (permalink / raw)
  To: Stefan Schmidt; +Cc: linux-wpan - ML, Alexander Aring

ACK-by: Xue Liu <liuxuenetmail@gmail.com>

On 12 April 2018 at 14:28, Stefan Schmidt <stefan@osg.samsung.com> wrote:
> We already allocated the device and platform  data at this
> point. Instead of simply return from the probe function we
> need to cleanup the resources first.
>
> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
> ---
>  drivers/net/ieee802154/mcr20a.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
> index 944470d69ba9..de0d7f28a181 100644
> --- a/drivers/net/ieee802154/mcr20a.c
> +++ b/drivers/net/ieee802154/mcr20a.c
> @@ -1309,8 +1309,10 @@ mcr20a_probe(struct spi_device *spi)
>         /* init buf */
>         lp->buf = devm_kzalloc(&spi->dev, SPI_COMMAND_BUFFER, GFP_KERNEL);
>
> -       if (!lp->buf)
> -               return -ENOMEM;
> +       if (!lp->buf) {
> +               ret = -ENOMEM;
> +               goto free_dev;
> +       }
>
>         mcr20a_setup_tx_spi_messages(lp);
>         mcr20a_setup_rx_spi_messages(lp);
> --
> 2.14.3
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: ieee802154: mcr20a: do not leak resources on error path
  2018-04-12 12:38 ` Xue Liu
@ 2018-04-12 13:23   ` Stefan Schmidt
  2018-04-12 13:27     ` Xue Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Schmidt @ 2018-04-12 13:23 UTC (permalink / raw)
  To: Xue Liu; +Cc: linux-wpan - ML, Alexander Aring

Hello Xue.


On 04/12/2018 02:38 PM, Xue Liu wrote:
> ACK-by: Xue Liu <liuxuenetmail@gmail.com>

Same as with your last ACK thsi is the wrong format.

I explained in the last mail the details. Please have nother read and send a correct Acked-By

line so patchwork can pick it up and it will be present in the commit when I test and push it.


regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: ieee802154: mcr20a: do not leak resources on error path
  2018-04-12 13:23   ` Stefan Schmidt
@ 2018-04-12 13:27     ` Xue Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Xue Liu @ 2018-04-12 13:27 UTC (permalink / raw)
  To: Stefan Schmidt; +Cc: linux-wpan - ML, Alexander Aring

Hello Stefan,

Thanks for the reminder. I will send a new one.

Regards,

Xue Liu

On 12 April 2018 at 15:23, Stefan Schmidt <stefan@osg.samsung.com> wrote:
> Hello Xue.
>
>
> On 04/12/2018 02:38 PM, Xue Liu wrote:
>> ACK-by: Xue Liu <liuxuenetmail@gmail.com>
>
> Same as with your last ACK thsi is the wrong format.
>
> I explained in the last mail the details. Please have nother read and send a correct Acked-By
>
> line so patchwork can pick it up and it will be present in the commit when I test and push it.
>
>
> regards
> Stefan Schmidt

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: ieee802154: mcr20a: do not leak resources on error path
  2018-04-12 12:28 [PATCH] net: ieee802154: mcr20a: do not leak resources on error path Stefan Schmidt
  2018-04-12 12:38 ` Xue Liu
@ 2018-04-12 13:28 ` Xue Liu
  2018-04-13  8:49   ` Stefan Schmidt
  1 sibling, 1 reply; 6+ messages in thread
From: Xue Liu @ 2018-04-12 13:28 UTC (permalink / raw)
  To: Stefan Schmidt; +Cc: linux-wpan - ML, Alexander Aring

Acked-by: Xue Liu <liuxuenetmail@gmail.com>

On 12 April 2018 at 14:28, Stefan Schmidt <stefan@osg.samsung.com> wrote:
> We already allocated the device and platform  data at this
> point. Instead of simply return from the probe function we
> need to cleanup the resources first.
>
> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
> ---
>  drivers/net/ieee802154/mcr20a.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
> index 944470d69ba9..de0d7f28a181 100644
> --- a/drivers/net/ieee802154/mcr20a.c
> +++ b/drivers/net/ieee802154/mcr20a.c
> @@ -1309,8 +1309,10 @@ mcr20a_probe(struct spi_device *spi)
>         /* init buf */
>         lp->buf = devm_kzalloc(&spi->dev, SPI_COMMAND_BUFFER, GFP_KERNEL);
>
> -       if (!lp->buf)
> -               return -ENOMEM;
> +       if (!lp->buf) {
> +               ret = -ENOMEM;
> +               goto free_dev;
> +       }
>
>         mcr20a_setup_tx_spi_messages(lp);
>         mcr20a_setup_rx_spi_messages(lp);
> --
> 2.14.3
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: ieee802154: mcr20a: do not leak resources on error path
  2018-04-12 13:28 ` Xue Liu
@ 2018-04-13  8:49   ` Stefan Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Schmidt @ 2018-04-13  8:49 UTC (permalink / raw)
  To: Xue Liu; +Cc: linux-wpan - ML, Alexander Aring

Hello.


On 04/12/2018 03:28 PM, Xue Liu wrote:
> Acked-by: Xue Liu <liuxuenetmail@gmail.com>

Thanks for the review, Xue.

>
> On 12 April 2018 at 14:28, Stefan Schmidt <stefan@osg.samsung.com> wrote:
>> We already allocated the device and platform  data at this
>> point. Instead of simply return from the probe function we
>> need to cleanup the resources first.
>>
>> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
>> ---
>>  drivers/net/ieee802154/mcr20a.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
>> index 944470d69ba9..de0d7f28a181 100644
>> --- a/drivers/net/ieee802154/mcr20a.c
>> +++ b/drivers/net/ieee802154/mcr20a.c
>> @@ -1309,8 +1309,10 @@ mcr20a_probe(struct spi_device *spi)
>>         /* init buf */
>>         lp->buf = devm_kzalloc(&spi->dev, SPI_COMMAND_BUFFER, GFP_KERNEL);
>>
>> -       if (!lp->buf)
>> -               return -ENOMEM;
>> +       if (!lp->buf) {
>> +               ret = -ENOMEM;
>> +               goto free_dev;
>> +       }
>>
>>         mcr20a_setup_tx_spi_messages(lp);
>>         mcr20a_setup_rx_spi_messages(lp);
>> --
>> 2.14.3
>>
This patch has been applied to the wpan tree and will be
part of the next pull request to net.

regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-04-13  8:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-12 12:28 [PATCH] net: ieee802154: mcr20a: do not leak resources on error path Stefan Schmidt
2018-04-12 12:38 ` Xue Liu
2018-04-12 13:23   ` Stefan Schmidt
2018-04-12 13:27     ` Xue Liu
2018-04-12 13:28 ` Xue Liu
2018-04-13  8:49   ` Stefan Schmidt

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.