mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: stable@vger.kernel.org
Cc: "Storm Dragon" <stormdragon2976@gmail.com>,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Please backport commit ae3419fbac84 ("vc_screen: don't clobber return value in vcs_read")
Date: Tue, 28 Feb 2023 03:42:12 +0000	[thread overview]
Message-ID: <15acd998-ea8a-4897-9920-dd19fc06a996@t-8ch.de> (raw)

Hi,

please backport the following commit[0] to all stable releases that
contain the commit
226fae124b2d ("vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF")

Commit 46d733d0efc7 ("vc_screen: modify vcs_size() handling in vcs_read()") [1]
also tries to fix this commit but should not actually be necessary for a
proper fix. It may make sense to also backport for consistency.


commit ae3419fbac845b4d3f3a9fae4cc80c68d82cdf6e
Author: Thomas Weißschuh <linux@weissschuh.net>
Date:   Mon Feb 20 06:46:12 2023 +0000

    vc_screen: don't clobber return value in vcs_read
    
    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.
    
    [ Also, the 'goto unlock_out" needs to be just a "break", so that it
      does the right thing when it exits on later iterations when partial
      success has happened - Linus ]
    
    Reported-by: Storm Dragon <stormdragon2976@gmail.com>
    Link: https://lore.kernel.org/lkml/Y%2FKS6vdql2pIsCiI@hotmail.com/
    Fixes: 226fae124b2d ("vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF")
    Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
    Link: https://lore.kernel.org/lkml/64981d94-d00c-4b31-9063-43ad0a384bde@t-8ch.de/
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


Thanks,
Thomas

[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ae3419fbac845b4d3f3a9fae4cc80c68d82cdf6e
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=46d733d0efc79bc8430d63b57ab88011806d5180

             reply	other threads:[~2023-02-28  3:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28  3:42 Thomas Weißschuh [this message]
2023-02-28 18:36 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15acd998-ea8a-4897-9920-dd19fc06a996@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stormdragon2976@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®