The patch titled Subject: lib: fix test_hmm.c reference after free has been added to the -mm tree. Its filename is lib-fix-test_hmmc-reference-after-free.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/lib-fix-test_hmmc-reference-after-free.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/lib-fix-test_hmmc-reference-after-free.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx> Subject: lib: fix test_hmm.c reference after free Coccinelle scripts report the following errors: lib/test_hmm.c:523:20-26: ERROR: reference preceded by free on line 521 lib/test_hmm.c:524:21-27: ERROR: reference preceded by free on line 521 lib/test_hmm.c:523:28-35: ERROR: devmem is NULL but dereferenced. lib/test_hmm.c:524:29-36: ERROR: devmem is NULL but dereferenced. Fix these by using the local variable 'res' instead of devmem. Link: http://lkml.kernel.org/r/c845c158-9c65-9665-0d0b-00342846dd07@xxxxxxxxxxxxx Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx> Reviewed-by: Ralph Campbell <rcampbell@xxxxxxxxxx> Cc: Jérôme Glisse <jglisse@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/test_hmm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/lib/test_hmm.c~lib-fix-test_hmmc-reference-after-free +++ a/lib/test_hmm.c @@ -520,8 +520,7 @@ static bool dmirror_allocate_chunk(struc err_free: kfree(devmem); err_release: - release_mem_region(devmem->pagemap.res.start, - resource_size(&devmem->pagemap.res)); + release_mem_region(res->start, resource_size(res)); err: mutex_unlock(&mdevice->devmem_lock); return false; _ Patches currently in -mm which might be from rdunlap@xxxxxxxxxxxxx are lib-fix-test_hmmc-reference-after-free.patch