[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2jJBxEDD+FXpHsFXRd9BF3aND2jTtswzP1L6_T4BiS9A@mail.gmail.com>
Date: Fri, 25 Sep 2020 09:32:14 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Sherry Sun <sherry.sun@....com>
Cc: Sudeep Dutt <sudeep.dutt@...el.com>,
Ashutosh Dixit <ashutosh.dixit@...el.com>,
gregkh <gregkh@...uxfoundation.org>,
Rikard Falkeborn <rikard.falkeborn@...il.com>,
Lee Jones <lee.jones@...aro.org>,
"Michael S. Tsirkin" <mst@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
NXP Linux Team <linux-imx@....com>
Subject: Re: [PATCH 4/4] mic: vop: copy data to kernel space then write to io memory
On Fri, Sep 25, 2020 at 9:22 AM Sherry Sun <sherry.sun@....com> wrote:
>
> @@ -655,12 +656,15 @@ static int vop_virtio_copy_from_user(struct vop_vdev *vdev, void __user *ubuf,
> * We are copying to IO below and should ideally use something
> * like copy_from_user_toio(..) if it existed.
> */
> - if (copy_from_user((void __force *)dbuf, ubuf, len)) {
> + temp = kmalloc(len, GFP_KERNEL);
> + if (copy_from_user(temp, ubuf, len))
This needs to have error handling for a kmalloc() failure. As the length
appears to be user-provided, you might also want to limit the size of
the allocation and instead do a loop with multiple copies if there is
more data than fits into the allocation.
Arnd
Powered by blists - more mailing lists