Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1931242imm; Thu, 24 May 2018 03:08:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpLg4iJTr/amLqSPzLcwpLagU5TZvRX5HrPdIBU1mJwLHgMtbf+efLvlPQzuUzQ6QFtJZaV X-Received: by 2002:a63:89c2:: with SMTP id v185-v6mr3392022pgd.196.1527156486884; Thu, 24 May 2018 03:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156486; cv=none; d=google.com; s=arc-20160816; b=Dvu5cfVmj7G465lutXNm1vZAzrA4xEfgd9uRETFb9MeQduyX8So/kkgeW0FcZ2892Y MisUC/1TatA2aZrEfD2/4FHiJzHSo0p1gwhkhlicmR8PF/F61OU0G8G5BTmayjCTmRFc 8dNBi5rEHpX8HM4ZFJr1OkbMoqTNGJsqoCwfgx1klhGAoOEIsLE1aq6bi74DgK4HiMdr qybjSfNHRtIVaTOykq27GFcVfN2R1J06n0Hs+bHt8a9Ilz2YampxeyiDr4XQKXtENKqY nPNEH2wbyCepqXTjRpmINA4LRnPc1s77KJzFyTRxg9pd8TCV1tQF41xTAIhT9ISp0WMl /Zlw== 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=JVy8dUc2b+1lLlYCkF5m1jySzNlk3BJynxVmPspa2Zg=; b=HObDpsYmdH5tzLrP5SaL1Dae2Ogw9VBzx8H1D2+lhrg2+0IK60TCMXPXE5lNJ1Yija KPnfb656c8rSUaZVKyNpJ7fc7ju6KoUnA/am/ZuT0kU3xfU7+wa2krgHplev0/V1Bsl8 HLF8jITfXTvPeduF+MVkvJPEi9i1+CbjmEE7gznqVXFlkSeV+a5sLObDZHFP6p6h0Tpf QdKjr0MmoWbofdp+btHZZv7g6UdUPBrmRHy3+LDEA2/z69smvRdiZW9IHhjwgmlanmjX N5eDM847SRNC4PPM0HsAJz69oZLJ7V/BVWgzVrFnczyt0PpjySioa5MeCfoeVJKLzTq/ xBew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HJffrwjB; 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 b96-v6si21228281pli.172.2018.05.24.03.07.52; Thu, 24 May 2018 03:08:06 -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=HJffrwjB; 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 S1031753AbeEXKGk (ORCPT + 99 others); Thu, 24 May 2018 06:06:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:55416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031712AbeEXKGX (ORCPT ); Thu, 24 May 2018 06:06:23 -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 C617120893; Thu, 24 May 2018 10:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156383; bh=2fcMpEVERvHgJDA/wqnr3yqJBehtO8+oa5h4nVFUREY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HJffrwjBzzixiexSSPMWe4gifQCNlF5cng+R0alqm7r8pnAth39UeSgbwZF5n01z8 FpylTrEK8ltx+kItRXslvYCK1biXP/dBowPmQQv1rHi0kyg/txYx4rkFFkRwkRuKAe D4Fi8FrPtu878urZ4W2lKwJafDPNFKxlNlBxStPE= 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.16 142/161] media: vb2: Fix videobuf2 to map correct area Date: Thu, 24 May 2018 11:39:27 +0200 Message-Id: <20180524093035.382416519@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@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.16-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/common/videobuf2/videobuf2-vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c +++ b/drivers/media/common/videobuf2/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);