Re: [PATCH v2] mailbox: pcc: Add missed acpi_put_table() to fix memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> In pcc_mbox_probe(), the PCCT table acquired via acpi_get_table()
> is only released in error paths but not in the success path. This
> leads to a permanent ACPI memory leak when the driver successfully
> initializes.

* You may occasionally put more than 66 characters into text lines
  of such a change description.
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16#n658

* See also once more:
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16#n94


…> ---
> Changes in v2:
> - Add tags of 'Fixes' and 'Cc'
> - Change goto target from out_put_pcct to e_nomem
…> +++ b/drivers/mailbox/pcc.c
> @@ -763,19 +763,19 @@ static int pcc_mbox_probe(struct platform_device *pdev)
>  					 GFP_KERNEL);
>  	if (!pcc_mbox_channels) {
>  		rc = -ENOMEM;
> -		goto err;
> +		goto e_nomem;
>  	}
…

Why do you not move the assignment statement accordingly?


…> @@ -796,17 +796,17 @@ static int pcc_mbox_probe(struct platform_device *pdev)
>  		    !pcc_mbox_ctrl->txdone_irq) {
>  			pr_err("Platform Interrupt flag must be set to 1");
>  			rc = -EINVAL;
> -			goto err;
> +			goto e_nomem;
>  		}
…

You misunderstood one of my development suggestions.


…> @@ -827,9 +827,8 @@ static int pcc_mbox_probe(struct platform_device *pdev)
…> -		return 0;
> -err:
> +
> +e_nomem:
>  	acpi_put_table(pcct_tbl);
>  	return rc;
>  }
Would an other code variant be more reasonable?

e_nomem:
	rc = -ENOMEM;
	goto err;


Regards,
Markus





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux