Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: staging: rkisp1: params: don't release lock in isr before buffer is done

In the irq handler 'rkisp1_params_isr', the lock 'config_lock'
should be held as long as the current buffer is used. Otherwise the
stop_streaming calback might remove it from the list and
pass it to userspace while it is referenced in the irq handler.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Dafna Hirschfeld and committed by
Mauro Carvalho Chehab
581214d3 fb4ca983

+4 -4
+4 -4
drivers/staging/media/rkisp1/rkisp1-params.c
··· 1202 1202 if (!list_empty(&params->params)) 1203 1203 cur_buf = list_first_entry(&params->params, 1204 1204 struct rkisp1_buffer, queue); 1205 - spin_unlock(&params->config_lock); 1206 1205 1207 - if (!cur_buf) 1206 + if (!cur_buf) { 1207 + spin_unlock(&params->config_lock); 1208 1208 return; 1209 + } 1209 1210 1210 1211 new_params = (struct rkisp1_params_cfg *)(cur_buf->vaddr); 1211 1212 ··· 1216 1215 /* update shadow register immediately */ 1217 1216 rkisp1_param_set_bits(params, RKISP1_CIF_ISP_CTRL, RKISP1_CIF_ISP_CTRL_ISP_CFG_UPD); 1218 1217 1219 - spin_lock(&params->config_lock); 1220 1218 list_del(&cur_buf->queue); 1221 - spin_unlock(&params->config_lock); 1222 1219 1223 1220 cur_buf->vb.sequence = frame_sequence; 1224 1221 vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE); 1222 + spin_unlock(&params->config_lock); 1225 1223 } 1226 1224 1227 1225 static const struct rkisp1_cif_isp_awb_meas_config rkisp1_awb_params_default_config = {