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 <[email protected]>
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 <[email protected]>
Link: https://lore.kernel.org/lkml/Y%[email protected]/
Fixes: 226fae124b2d ("vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF")
Signed-off-by: Thomas Weißschuh <[email protected]>
Link: https://lore.kernel.org/lkml/[email protected]/
Signed-off-by: Linus Torvalds <[email protected]>
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
On Tue, Feb 28, 2023 at 03:42:12AM +0000, Thomas Wei?schuh wrote:
> 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.
Now queued up, thanks.
greg k-h