From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757498Ab2DXUIU (ORCPT ); Tue, 24 Apr 2012 16:08:20 -0400 Received: from mail-lpp01m010-f46.google.com ([209.85.215.46]:34527 "EHLO mail-lpp01m010-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757416Ab2DXUIS (ORCPT ); Tue, 24 Apr 2012 16:08:18 -0400 Date: Wed, 25 Apr 2012 00:08:13 +0400 From: Cyrill Gorcunov To: Andrew Morton Cc: LKML , "Michael Kerrisk (man-pages)" , KOSAKI Motohiro , Pavel Emelyanov , Tejun Heo , Kees Cook , Serge Hallyn , MEZAWA Hiroyuki Subject: [PATCH -mm] c/r: prctl: Return -EFAULT instead of -EINVAL in case if underlied VMA is not found Message-ID: <20120424200813.GK21224@moon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case if underlied VMA is not found prctl_set_mm will return -EINVAL, but Michael proposed to return -EFAULT and Kosaki seconded. Make it so. Reported-by: "Michael Kerrisk (man-pages)" Signed-off-by: Cyrill Gorcunov Cc: KOSAKI Motohiro Cc: Pavel Emelyanov , Cc: Tejun Heo Cc: Kees Cook Cc: Serge Hallyn Cc: KAMEZAWA Hiroyuki Cc: Andrew Morton --- kernel/sys.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: linux-2.6.git/kernel/sys.c =================================================================== --- linux-2.6.git.orig/kernel/sys.c +++ linux-2.6.git/kernel/sys.c @@ -1838,8 +1838,10 @@ static int prctl_set_mm(int opt, unsigne case PR_SET_MM_ARG_END: case PR_SET_MM_ENV_START: case PR_SET_MM_ENV_END: - if (!vma) + if (!vma) { + error = -EFAULT; goto out; + } #ifdef CONFIG_STACK_GROWSUP if (vma_flags_mismatch(vma, VM_READ | VM_WRITE | VM_GROWSUP, 0)) #else