Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1218668

Re: [PATCH] arch: ia64: kernel: perfmon: Check return value of insert_vm_struct()

From Chen Gang <gchen_5i5j@21cn.com>
Newsgroups linux.kernel
Subject Re: [PATCH] arch: ia64: kernel: perfmon: Check return value of insert_vm_struct()
Date 2015-09-04 05:50 +0200
Message-ID <q4QaJ-75R-5@gated-at.bofh.it> (permalink)
References <q0H61-7co-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello Maintainers:

Please help check this patch when you have time.

Thanks.

On 8/24/15 01:18, Chen Gang wrote:
> In pfm_smpl_buffer_alloc, insert_vm_struct may also return -ENOMEM, so
> need check it too.
> 
> And insert_vm_struct needn't consider about pfm_remap_buffer in failure
> process ("goto error" is enough):
> 
>  - pfm_remap_buffer doen't consider about remap_pfn_range.
> 
>  - It is about the relationship between vma and smpl_buf.
> 
>  - SO if both vma and smpl_buf are released ("goto error"), all things
>    are OK.
> 
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> ---
>  arch/ia64/kernel/perfmon.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
> index 60e02f7..ae77946 100644
> --- a/arch/ia64/kernel/perfmon.c
> +++ b/arch/ia64/kernel/perfmon.c
> @@ -2330,7 +2330,11 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t
>  	 * now insert the vma in the vm list for the process, must be
>  	 * done with mmap lock held
>  	 */
> -	insert_vm_struct(mm, vma);
> +	if (insert_vm_struct(mm, vma)) {
> +		DPRINT(("Can't insert vm structure.\n"));
> +		up_write(&task->mm->mmap_sem);
> +		goto error;
> +	}
>  
>  	vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
>  							vma_pages(vma));
> -- 
> 
>  		 	   		  
> 

-- 
Chen Gang (陈刚)

Open, share, and attitude like air, water, and life which God blessed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] arch: ia64: kernel: perfmon: Check return value of  insert_vm_struct() Chen Gang <xili_gchen_5257@hotmail.com> - 2015-08-23 19:20 +0200
  Re: [PATCH] arch: ia64: kernel: perfmon: Check return value of insert_vm_struct() Chen Gang <gchen_5i5j@21cn.com> - 2015-09-04 05:50 +0200

csiph-web