Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1969189imm; Thu, 24 May 2018 03:46:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoUcMFeOlEmqdNB2nMUvjiul2plKN2Pm11JtLXeoKkjzEvKI07iexjLXRpYqp50Z/dOBmz0 X-Received: by 2002:a17:902:5610:: with SMTP id h16-v6mr6812246pli.140.1527158804694; Thu, 24 May 2018 03:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527158804; cv=none; d=google.com; s=arc-20160816; b=oCZhz+8/KJtEO2HEokh21QgaO+sqsu+y51ZW/5dc6YI0TKWgV6EQCsCeiqeSrZDi9R iWYwnFT7+uUD22GzL81k+WJIwUkZdvB3ITjXyXOSRyRSn8v9v8XAzW+H18EcgbV9uzk7 stj+B7rmEPDcE1mtRGNblFS8Agb+vP5sAQV+CNyiymd67Rs73aqjKa48Jol2iR/e8xE1 jzbXihJ23rC+Og7dmAZbowD7v59ui1lj+LrXm8OYKE1zfyuDZabE5D5kn1qbGabYd9XO dS7L7Y37sxGqrXW2DFrEuvtor4muVKfQguL+41V8/k+iv9U15nOxqB/SOswKoBiew/uE tYjQ== 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=Gyw4DoEoSOzto7u0WfbpHHsNDdgtXz27gLd95fg1d0Q=; b=mh6D/7Ripc1xW08YN9ZuaL+D3xeQeUNn7g36mOcuWEXw8uQ2XAyENuauFjV2XEOyaZ UsmMn8YO0kl6GjHE+WH0W1ugBvVgI+p+LSEtl9EfVcA/0e+mdFzeKhm+kZpKyDqMnyKd juKERgPS7nzj2aeP3cx7u7YmxX26Nl3gBzukDkko/ZM4xzwTyz3hjDhDpG+U5g5pKTSh MuTebHTI+VwlgQy3XEbSN1A7cmodpdVU6hKztmZ21m3VyemR6fHEs9t+8WMB1/fT6REd UYcokA8TXKsw+kmZwJGG/ulzgCRReWL1SzBO0hEmkI+R9Op8ZBxTgNxoNeK9S45F3JeA 5o6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hp4jusLE; 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 c13-v6si17044837pgt.649.2018.05.24.03.46.30; Thu, 24 May 2018 03:46:44 -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=hp4jusLE; 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 S1032407AbeEXKpn (ORCPT + 99 others); Thu, 24 May 2018 06:45:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:37644 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030266AbeEXJ5y (ORCPT ); Thu, 24 May 2018 05:57:54 -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 8EBA820891; Thu, 24 May 2018 09:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155874; bh=wm2DgtnH8Iu0D0SXEnY1+4puW/xR32aCZ6bpw+Bb7uE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hp4jusLEBJL46un+4VT/e6gkqUxU+8iMt9I+1W3Y4HBoNg3v8i6t18f5I5l7gZTol CxiCKHioYH+b4JMboB0Db6q+4KmID3IT+n3oFCVcXc4vnYS+tEONlMJ4p3wkX7T7yv 33OEErYIpbAQU5R1v52wnsQA1NdBExlmg7T7GTUA= 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.14 147/165] media: vb2: Fix videobuf2 to map correct area Date: Thu, 24 May 2018 11:39:13 +0200 Message-Id: <20180524093628.023410816@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@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.14-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 @@ -106,7 +106,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);