media: staging/intel-ipu3: Fix race condition during set_fmt
authorRicardo Ribalda <ribalda@chromium.org>
Fri, 9 Apr 2021 08:41:35 +0000 (10:41 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 9 Apr 2021 11:07:09 +0000 (13:07 +0200)
commitdccfe2548746ca9cca3a20401ece4cf255d1f171
tree00f82c4a1d4bca72170859ba51fd104238ec140f
parent3630901933afba1d16c462b04d569b7576339223
media: staging/intel-ipu3: Fix race condition during set_fmt

Do not modify imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp, until the
format has been correctly validated.

Otherwise, even if we use a backup variable, there is a period of time
where imgu_pipe->nodes[inode].vdev_fmt.fmt.pix_mp might have an invalid
value that can be used by other functions.

Cc: stable@vger.kernel.org
Fixes: ad91849996f9 ("media: staging/intel-ipu3: Fix set_fmt error handling")
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/ipu3/ipu3-v4l2.c