Messages in this thread | | | Date | Fri, 26 Dec 2014 14:16:32 -0500 | From | Alex Gartrell <> | Subject | Re: [PATCH net-next 2/2] tun: enable socket system calls |
| |
Hello Jason,
Thanks for commenting.
On 12/26/14 4:43 AM, Jason Wang wrote: > > On 12/26/2014 02:50 PM, Alex Gartrell wrote: >> By setting private_data to a socket and private_data_is_socket to true, we >> can use the socket syscalls. We also can't just blindly use private_data >> anymore, so there's a __tun_file_get function that returns the container_of >> private_data appropriately. > > So this in fact expose other socket syscalls to userspace. But some of > proto_ops was not supported. E.g consider what happens if a bind() was > called for tun socket?
Yeah, I erroneously assumed that NULL => sock_no_*, but a quick glance assures me that that's not the case. In this case, I'd need to introduce another patch that sets all of the additional ops to sock_no_*.
>> +static struct tun_file *tun_file_from_file(struct file *file) >> +{ >> + struct socket *s = (struct socket *)file->private_data; >> + >> + if (!s) > > Can s be NULL here? If yes, why tun_get() didn't check for NULL?
This check is just to ensure that tun_get_socket continues to work in the right way when passed a file with private_data set to NULL.
Thanks, -- Alex Gartrell <agartrell@fb.com>
| |