* [PATCH] kernel/memremap: Remove stale devres_free() call
@ 2018-03-06 4:56 Oliver O'Halloran
2018-03-06 8:28 ` Christoph Hellwig
2018-03-06 16:55 ` Logan Gunthorpe
0 siblings, 2 replies; 4+ messages in thread
From: Oliver O'Halloran @ 2018-03-06 4:56 UTC (permalink / raw)
To: linux-kernel
Cc: linux-nvdimm, Oliver O'Halloran, Logan Gunthorpe,
Christoph Hellwig, Dan Williams
devm_memremap_pages() was re-worked in e8d513483300 to take a caller
allocated struct dev_pagemap as a function parameter. A call to
devres_free() was left in the error cleanup path which results in
a kernel panic if the remap fails for some reason. Remove it
to fix the panic and let devm_memremap_pages() fail gracefully.
Fixes: e8d513483300 ("memremap: change devm_memremap_pages interface to use struct dev_pagemap")
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
Both in-tree users of devm_memremap_pages() embed dev_pagemap into other
structures so this shouldn't cause any leaks. Logan's p2p series does
add one usage that assumes pgmap will be freed on error so that'll
need fixing.
---
kernel/memremap.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/memremap.c b/kernel/memremap.c
index 4dd4274cabe2..895e6b76b25e 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -427,7 +427,6 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap)
err_pfn_remap:
err_radix:
pgmap_radix_release(res, pgoff);
- devres_free(pgmap);
return ERR_PTR(error);
}
EXPORT_SYMBOL(devm_memremap_pages);
--
2.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel/memremap: Remove stale devres_free() call
2018-03-06 4:56 [PATCH] kernel/memremap: Remove stale devres_free() call Oliver O'Halloran
@ 2018-03-06 8:28 ` Christoph Hellwig
2018-03-06 16:55 ` Logan Gunthorpe
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2018-03-06 8:28 UTC (permalink / raw)
To: Oliver O'Halloran
Cc: linux-kernel, linux-nvdimm, Logan Gunthorpe, Christoph Hellwig,
Dan Williams
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel/memremap: Remove stale devres_free() call
2018-03-06 4:56 [PATCH] kernel/memremap: Remove stale devres_free() call Oliver O'Halloran
2018-03-06 8:28 ` Christoph Hellwig
@ 2018-03-06 16:55 ` Logan Gunthorpe
2018-03-06 19:09 ` Dan Williams
1 sibling, 1 reply; 4+ messages in thread
From: Logan Gunthorpe @ 2018-03-06 16:55 UTC (permalink / raw)
To: Oliver O'Halloran, linux-kernel
Cc: linux-nvdimm, Christoph Hellwig, Dan Williams
On 05/03/18 09:56 PM, Oliver O'Halloran wrote:
> devm_memremap_pages() was re-worked in e8d513483300 to take a caller
> allocated struct dev_pagemap as a function parameter. A call to
> devres_free() was left in the error cleanup path which results in
> a kernel panic if the remap fails for some reason. Remove it
> to fix the panic and let devm_memremap_pages() fail gracefully.
>
> Fixes: e8d513483300 ("memremap: change devm_memremap_pages interface to use struct dev_pagemap")
> Cc: Logan Gunthorpe <logang@deltatee.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
> ---
> Both in-tree users of devm_memremap_pages() embed dev_pagemap into other
> structures so this shouldn't cause any leaks. Logan's p2p series does
> add one usage that assumes pgmap will be freed on error so that'll
> need fixing.
Yup, nice catch! I'll fix that for the next series.
Thanks,
Logan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel/memremap: Remove stale devres_free() call
2018-03-06 16:55 ` Logan Gunthorpe
@ 2018-03-06 19:09 ` Dan Williams
0 siblings, 0 replies; 4+ messages in thread
From: Dan Williams @ 2018-03-06 19:09 UTC (permalink / raw)
To: Logan Gunthorpe
Cc: Oliver O'Halloran, Linux Kernel Mailing List, linux-nvdimm,
Christoph Hellwig
On Tue, Mar 6, 2018 at 8:55 AM, Logan Gunthorpe <logang@deltatee.com> wrote:
>
>
> On 05/03/18 09:56 PM, Oliver O'Halloran wrote:
>>
>> devm_memremap_pages() was re-worked in e8d513483300 to take a caller
>> allocated struct dev_pagemap as a function parameter. A call to
>> devres_free() was left in the error cleanup path which results in
>> a kernel panic if the remap fails for some reason. Remove it
>> to fix the panic and let devm_memremap_pages() fail gracefully.
>>
>> Fixes: e8d513483300 ("memremap: change devm_memremap_pages interface to
>> use struct dev_pagemap")
>> Cc: Logan Gunthorpe <logang@deltatee.com>
>> Cc: Christoph Hellwig <hch@lst.de>
>> Cc: Dan Williams <dan.j.williams@intel.com>
>> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
>
>
> Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Thanks, applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-06 19:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-06 4:56 [PATCH] kernel/memremap: Remove stale devres_free() call Oliver O'Halloran
2018-03-06 8:28 ` Christoph Hellwig
2018-03-06 16:55 ` Logan Gunthorpe
2018-03-06 19:09 ` Dan Williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).