Re: [PATCH RFC] tun: remove of user-controlled memory allocation

From: David Miller
Date: Mon Nov 01 2010 - 10:16:31 EST


From: "Michael S. Tsirkin" <mst@xxxxxxxxxx>
Date: Mon, 1 Nov 2010 10:27:49 +0200

> Untested, this is just an RFC.
>
> tun does a kmalloc where userspace controls the length. This will
> produce warnings in kernel log when the length is too large, or might
> block for a long while. A simple fix is to avoid the allocatiuon
> altogether, and copy from user in a loop.
>
> However, with this patch an illegal address passed to the ioctl might
> leave the filter disabled. Is this something we care about? If
> yes we could recover by creating a copy of the filter. Thoughts?
>
> Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>

I think the key issue in situations like this is simply to make
sure that reasonable things that worked before, still do afterwards.

And I think your patch does that, so it's fine as far as I can tell.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/