Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933703AbbFJPiH (ORCPT ); Wed, 10 Jun 2015 11:38:07 -0400 Received: from ip4-83-240-67-251.cust.nbox.cz ([83.240.67.251]:36021 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754304AbbFJP2B (ORCPT ); Wed, 10 Jun 2015 11:28:01 -0400 From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "jmarchan@redhat.com" , Benjamin Herrenschmidt , Jiri Slaby Subject: [PATCH 3.12 032/111] powerpc/mm: Fix mmap errno when MAP_FIXED is set and mapping exceeds the allowed address space Date: Wed, 10 Jun 2015 17:26:21 +0200 Message-Id: X-Mailer: git-send-email 2.4.2 In-Reply-To: <93091169a673f49c2574cddf1ef858cf0704f646.1433943052.git.jslaby@suse.cz> References: <93091169a673f49c2574cddf1ef858cf0704f646.1433943052.git.jslaby@suse.cz> In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1515 Lines: 43 From: "jmarchan@redhat.com" 3.12-stable review patch. If anyone has any objections, please let me know. =============== commit 19751c07b3728748c1253627ce94e6906fa5e273 upstream. According to Posix, if MAP_FIXED is specified mmap shall set ENOMEM if the requested mapping exceeds the allowed range for address space of the process. The generic code set it right, but the specific powerpc slice_get_unmapped_area() function currently returns -EINVAL in that case. This patch corrects it. Signed-off-by: Jerome Marchand Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Jiri Slaby --- arch/powerpc/mm/slice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c index 7ce9cf3b6988..b0c75cc15efc 100644 --- a/arch/powerpc/mm/slice.c +++ b/arch/powerpc/mm/slice.c @@ -408,7 +408,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len, if (fixed && (addr & ((1ul << pshift) - 1))) return -EINVAL; if (fixed && addr > (mm->task_size - len)) - return -EINVAL; + return -ENOMEM; /* If hint, make sure it matches our alignment restrictions */ if (!fixed && addr) { -- 2.4.2 -- 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/