[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR04MB4960F5105C6C54F17700352092360@VI1PR04MB4960.eurprd04.prod.outlook.com>
Date: Fri, 25 Sep 2020 07:50:49 +0000
From: Sherry Sun <sherry.sun@....com>
To: Arnd Bergmann <arnd@...db.de>
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>,
dl-linux-imx <linux-imx@....com>
Subject: RE: [PATCH 4/4] mic: vop: copy data to kernel space then write to io
memory
Hi Arnd,
> 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.
Thanks for your quick reply, you are right, will add error handling for kmalloc() failure and size limit handling in v2.
Regards
Sherry
>
> Arnd
Powered by blists - more mailing lists