Re: [PATCH] vc_screen: don't clobber return value in vcs_read

From: Greg Kroah-Hartman
Date: Tue Feb 21 2023 - 08:50:33 EST


On Tue, Feb 21, 2023 at 08:30:11AM -0500, George Kennedy wrote:
>
>
> On 2/20/2023 11:34 AM, Thomas Weißschuh wrote:
> > +Cc people who were involved in the original thread.
> >
> > On Mon, Feb 20, 2023 at 12:48:59PM +0100, Jiri Slaby wrote:
> > > On 20. 02. 23, 7:46, linux@xxxxxxxxxxxxxx wrote:
> > > > From: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
> > > >
> > > > Commit 226fae124b2d
> > > > ("vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF")
> > > > moved the call to vcs_vc() into the loop.
> > > > While doing this it also moved the unconditional assignment of
> > > > "ret = -ENXIO".
> > > > This unconditional assignment was valid outside the loop but within it
> > > > it clobbers the actual value of ret.
> > > >
> > > > To avoid this only assign "ret = -ENXIO" when actually needed.
> > > Not sure -- I cannot find it -- but hasn't George fixed this yet?
> > Indeed there was a proposed fix at
> > https://lore.kernel.org/lkml/1675704844-17228-1-git-send-email-george.kennedy@xxxxxxxxxx/
> >
> > Linus had some suggestions so it was not applied as is.
> >
> > I'm not sure what the current state is.
> > George, do you have something in the pipeline?
>
> Yes, that is in the pipeline:
> https://lore.kernel.org/lkml/1675774098-17722-1-git-send-email-george.kennedy@xxxxxxxxxx/
>
> Linus suggested the fix, which was tested and submitted.
>
> Jiri commented on the patch, which I believe was directed at Linus as he
> suggested the fix.

And I was waiting for a new version from you based on those comments :(

Can you fix that up and send?

thanks,

greg k-h