Re: [PATCH v6 3/5] misc: fastrpc: Add support for context Invoke method

From: Greg KH
Date: Fri Feb 08 2019 - 09:11:26 EST


On Fri, Feb 08, 2019 at 02:01:33PM +0000, Srinivas Kandagatla wrote:
> Thanks for the review,
>
> On 08/02/2019 13:55, Greg KH wrote:
> > > +
> > > + /* Make sure reserved field is set to 0 */
> > > + if (args->reserved) {
> > > + kfree(args);
> > > + return -EINVAL;
> > Am I wrong in that you are only checking the first reserved field in
> > this array of args? Don't you have a whole bunch of them here (nscalars
> > of them)? Don't you need to check them all and not just the first one?
> My Bad, there should be a loop here!
> I will fix this in next version!

No, you don't need to loop it here, check it in the call that evaluates
the individual args, which will catch the issue when people send
"internal" commands.

Which reminds me, what happens if a sequence has problems half way
through the list of args? Do you "roll back" to the beginning, or just
abort? What happens to the internal device state then?

thanks,

greg k-h