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

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

 



Hello,

On Wed, Sep 30, 2020 at 06:03:57PM +0200, Michal Koutný wrote:
> 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.

So, I'm not necessarily against the change, mostly in the spirit of "why
not?".

> > @@ -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? 

But yeah, please do it in one spot.

Thanks.

-- 
tejun



[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