Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2016144imm; Thu, 24 May 2018 04:33:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZplziRP0CoALDOzNwfk59QhYQyvSPu3ZP9eQt7OiDQScAr4f6EIJVE7+P7/SsJpfBtoEnnq X-Received: by 2002:a65:6557:: with SMTP id a23-v6mr5517736pgw.319.1527161637334; Thu, 24 May 2018 04:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527161637; cv=none; d=google.com; s=arc-20160816; b=HKcFpRZjbUMeiQLls3BXBXq7/HnaJAYXOuJr0pJYUqmus40+cNg31yv1aJZAwaRMuw Hn3GtkrtuwcW2Us2uMr6+U35SWHAh6yLmKfH6wl4HrMGVfoWBVX6mb9mplFkHzVr3IN5 GA10BOPkKJ2JvgJkxfyYRFktj51pLdLlWPRks1NMI3vLdqraT5xAQ+QCoHQg6NC2RqlM j9Oy6XhNOzKAe3ULmZNnPfrjnMLZaZDsQAexDE9t+gsS1ntjMYS41+mSSXwQKBjS+pYH nTYQSKyuL1KYR5V8xMQA3wP8cLT4DKYEX4WJl4oS0u5zsgj1TfxuwuL44aNvk5ZH/mAE Fk2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=talO8KWNjsC7hlRFUWDhyqT67kadIALvr21aCqmo1JQ=; b=GN8Pmc8c9xdk2YaUO/uZF7OL+LnielfnUPqo5RK/9RZQAFe2jHjDBJsAsiYPIk/XWf NKCrDktmSYoq79q4bLJui2X1eCpXjedfd//T7SEeHhhn4LxrWHYCd7YWpQbQWKgub/qy nkIofedSs5MN2DY4VZJclj8XIj3wL5CKWSyf1t2ANYKOHyE9lNkPy+dg/09IwQOAK7HJ mYYavIoUl4NI+cL/1f14+Fty4G6LxhezPxn5dcb0zNL986OFdhukOT//yrhQDlkr3BlE mbN5h/d7BrXD4BJOv/GVG/94xR35w6T7PNRY8N9UhVKkiu/dgdu+39l6DCeFhNWVrgmF 2Lqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KtBlaVuj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 127-v6si12352952pgg.29.2018.05.24.04.33.42; Thu, 24 May 2018 04:33:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KtBlaVuj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969016AbeEXLdB (ORCPT + 99 others); Thu, 24 May 2018 07:33:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:42064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967102AbeEXJuf (ORCPT ); Thu, 24 May 2018 05:50:35 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 45CE3208A0; Thu, 24 May 2018 09:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155434; bh=wjvH6yq1kFsu+/8ol7xy3cBaPNQFs0Ix/u0Ln+lHJkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KtBlaVuj6ZLtrUBT1sLl8VUmqw4FRHuYTCvGAejo7SDhUIt8t/9khtIKLCQbDBYwo xXWc3CVAUJrHBiZcbH/oQR/UN9fxtR9Q5/1V9ZB5klp2PQXey1Ml9D1xmp4gEz1BnB u+TOPyWFQMqqtvah2nTePXICnWmEAMK0lRAlDAW8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Takao Orito , Fumihiro ATSUMI , Marek Szyprowski , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.9 84/96] media: vb2: Fix videobuf2 to map correct area Date: Thu, 24 May 2018 11:39:07 +0200 Message-Id: <20180524093610.216394292@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093605.602125311@linuxfoundation.org> References: <20180524093605.602125311@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Masami Hiramatsu [ Upstream commit d13a0139d7874a0577b5955d6eed895517d23b72 ] Fixes vb2_vmalloc_get_userptr() to ioremap correct area. Since the current code does ioremap the page address, if the offset > 0, it does not do ioremap the last page and results in kernel panic. This fixes to pass the size + offset to ioremap so that ioremap can map correct area. Also, this uses __pfn_to_phys() to get the physical address of given PFN. Signed-off-by: Masami Hiramatsu Reported-by: Takao Orito Reported-by: Fumihiro ATSUMI Reviewed-by: Marek Szyprowski Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/media/v4l2-core/videobuf2-vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/media/v4l2-core/videobuf2-vmalloc.c +++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c @@ -104,7 +104,7 @@ static void *vb2_vmalloc_get_userptr(str if (nums[i-1] + 1 != nums[i]) goto fail_map; buf->vaddr = (__force void *) - ioremap_nocache(nums[0] << PAGE_SHIFT, size); + ioremap_nocache(__pfn_to_phys(nums[0]), size + offset); } else { buf->vaddr = vm_map_ram(frame_vector_pages(vec), n_pages, -1, PAGE_KERNEL);