Re: [PATCH 3/3] lguest: force file->private_data to be NULL on open()

From: Martin Kepplinger
Date: Mon Oct 20 2014 - 09:43:36 EST


Am 2014-10-19 02:31, schrieb Martin Kepplinger:
> if we depend on private_data being NULL in write() before initialize()
> make sure it is NULL after open().
>
> Signed-off-by: Martin Kepplinger <martink@xxxxxxxxx>
> ---
>
> I'm not completely sure if this patch is needed and am still investigating.
> What do you think? open() could be called by the user I guess. Does
> lguest_user.c depend on private_data being NULL on a first write()?
>
>

Could it be that this patch is not needed indeed or did I ask not clear
enough here and caused a misunderstanding:


> Martin Kepplinger <martink@xxxxxxxxx> writes:
>> hi
>>
>> Just a question for understanding: open() is not implemented in
>> lguest_user.c's miscdevice. The miscdevice core, in this case, does
>> _not_ set file->private_data on a user's open() call. Is open() called
>> by the user here? and do you here _depend_ on file->private_data being
>> NULL after open()? (could you even?)
>>
>> Would the following force to NULL be necessary if the miscdevice core
>> _would_ set private_data?
>
> Hi Martin!
>
> Yes, the private_data is NULL on a new file. See
> get_empty_filp in fs/file_table.c, which does kmem_cache_zalloc
> (zeroing all the contents).
>
> So this isn't necessary here.
>
> Thanks!
> Rusty.

--
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/