Re: [PATCH] cgroup: Zero sized write should be no-op

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jouni.

On Mon, Sep 28, 2020 at 04:10:13PM +0300, Jouni Roivas <jouni.roivas@xxxxxxxxxx> wrote:
> Do not report failure on zero sized writes, and handle them as no-op.
This is a user visible change (in the case of a single write(2)), OTOH,
`man write` says:
> If count is zero and fd refers to a file other than a regular file,
> the results are not specified.


> @@ -3682,6 +3700,9 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,
>  	struct cgroup_subsys_state *css;
>  	int ret;
>  
> +	if (!nbytes)
> +		return 0;
> +
>  	/*
>  	 * If namespaces are delegation boundaries, disallow writes to
>  	 * files in an non-init namespace root from inside the namespace
Shouldn't just this guard be sufficient? 

Michal



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux