[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200522110623.GL30374@kadam>
Date: Fri, 22 May 2020 14:06:24 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Mitchell Tasman <tasman@...flabs.com>
Cc: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jamal Shareef <jamal.k.shareef@...il.com>,
Marcelo Diop-Gonzalez <marcgonzalez@...gle.com>,
Nishka Dasgupta <nishkadg.linux@...il.com>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
bcm-kernel-feedback-list@...adcom.com,
linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] staging: vchiq_arm: cast with __force as needed
On Mon, May 18, 2020 at 08:45:31PM -0400, Mitchell Tasman wrote:
> In several cases where a pointer marked as __user is
> (intentionally) assigned or passed to a non-marked target,
> cast to the target pointer type with a __force directive
> to quiet warnings from sparse.
>
> Signed-off-by: Mitchell Tasman <tasman@...flabs.com>
> ---
> .../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 7 ++++---
> .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 +++-
> 2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
> index c18c6ca0b6c0..38a13e4618a8 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
> @@ -371,14 +371,15 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
> pagelistinfo->scatterlist = scatterlist;
> pagelistinfo->scatterlist_mapped = 0;
>
> - if (is_vmalloc_addr(buf)) {
> + if (is_vmalloc_addr((void __force *)buf)) {
Am I reading this correctly???
This is actually a user controlled pointer that comes from the
vchiq_ioctl() when we do VCHIQ_IOC_QUEUE_BULK_TRANSMIT/RECEIVE. So we
take random pointer from user space and if it happens to point to kernel
space then we trust it and presumably start BULK_TRANSMITing data to
it???
LOL.... This doesn't seem safe at all.
regards,
dan carpenter
Powered by blists - more mailing lists