Xavier,there is no camera online, I execute the capture program and CTRL+C, then get kernel dump [l4t 32.3.1]

xavier,there is no camera online, I execute the capture program and CTRL+C, then get kernel dump [l4t 32.3.1]
The hardware is one dsu960 connected with 4 camera, I modified the ov5693 driver and devicetree to make xavier display 4 camera’s picture. The display is OK.
But when there is no camera online, I execute the capture program,and CTRL+C,the kernel crash.

FIRST crash position: I get the cred is NULL, and I modify the code as following.
/*

  • Clean up a task’s credentials when it exits
    */
    void exit_creds(struct task_struct *tsk)
    {
    struct cred *cred;
    //printk(“%s,%d,%llx,%llx\n”,FILE, LINE, tsk->real_cred,tsk->cred);
    kdebug(“exit_creds(%u,%p,%p,{%d,%d})”, tsk->pid, tsk->real_cred, tsk->cred,
    atomic_read(&tsk->cred->usage),
    read_cred_subscribers(tsk->cred));
    cred = (struct cred *) tsk->real_cred;
    if (cred != NULL) {
    // tsk->cred = NULL;
    // printk(“%s,%d\n”, FILE,LINE);
    // return;
    tsk->real_cred = NULL;
    validate_creds(cred);
    alter_cred_subscribers(cred, -1);
    put_cred(cred);
    }

    cred = (struct cred *) tsk->cred;
    if (cred != NULL) {
    // printk(“%s,%d\n”, FILE,LINE);
    // return;
    tsk->cred = NULL;
    validate_creds(cred);
    alter_cred_subscribers(cred, -1);
    put_cred(cred);
    }
    }

The second position:I get unpins_list pointer is NULL, and I modify the code as following
void vi_capture_request_unpin(struct tegra_vi_channel *chan,
uint32_t buffer_index)
{
struct vi_capture *capture = chan->capture_data;
struct capture_common_unpins *unpins;
int i = 0;

mutex_lock(&capture->unpins_list_lock);
printk("%s,%d,%llx,buffer_index,%d\n", __FILE__, __LINE__,(unsigned long long)capture->unpins_list,buffer_index);
if (capture->unpins_list != NULL) {
	unpins = capture->unpins_list[buffer_index];
	if (unpins != NULL) {
		for (i = 0; i < unpins->num_unpins; i++)
			capture_common_unpin_memory(&unpins->data[i]);
		capture->unpins_list[buffer_index] = NULL;
		kfree(unpins);
	}
}
mutex_unlock(&capture->unpins_list_lock);

}

After the two position modified, new question occured the kernel report warnning.The position is as following:
int tegra_capture_ivc_notify_chan_id(uint32_t chan_id, uint32_t trans_id):
if (WARN(civc->cb_ctx[chan_id].cb_func != NULL,
“channel context at %u is busy”, chan_id)) {
mutex_unlock(&civc->cb_ctx_lock);
return -EBUSY;
}
and then with watchdog problem.The log is as following
[ 39.761436] WARNING: CPU: 6 PID: 8216 at /home/zhou/work/xavier/xavier-kernel/try3/Linux_for_Tegra/source/public/kernel/nvidia/drivers/platform/tegra/rtcpu/capture-ivc.c:224 tegra_capture_ivc_notify_chan_id+0x184/0x1a0
[ 39.761931] —[ end trace fe555e77b74f2015 ]—
[ 39.762107] tegra194-vi5 15c10000.vi: failed to update control callback
[ 47.067107] nvgpu: 17000000.gv11b gk20a_channel_timeout_handler:1570 [ERR] Job on channel 509 timed out
[ 47.068146] nvgpu: 17000000.gv11b nvgpu_set_error_notifier_locked:137 [ERR] error notifier set to 8 for ch 509
[ 47.070147] nvgpu: 17000000.gv11b gk20a_channel_timeout_handler:1570 [ERR] Job on channel 511 timed out
[ 47.071485] nvgpu: 17000000.gv11b nvgpu_set_error_notifier_locked:137 [ERR] error notifier set to 8 for ch 511
[ 60.743050] Kernel panic - not syncing: Watchdog detected hard LOCKUP on cpu 6
[ 60.743211] CPU: 5 PID: 0 Comm: swapper/5 Tainted: G W 4.9.140-tegra #66
[ 60.743336] Hardware name: Jetson-AGX (DT)
[ 60.743410] Call trace:
[ 60.743468] [] dump_backtrace+0x0/0x198
[ 60.743561] [] show_stack+0x24/0x30
[ 60.743651] [] dump_stack+0x98/0xc0
[ 60.743742] [] panic+0x11c/0x298
[ 60.743827] [] watchdog_check_hardlockup_other_cpu+0x11c/0x120
[ 60.743949] [] watchdog_timer_fn+0x98/0x2c0
[ 60.744068] [] __hrtimer_run_queues+0xd8/0x360
[ 60.744178] [] hrtimer_interrupt+0xa8/0x1e0
[ 60.744277] [] arch_timer_handler_phys+0x38/0x58
[ 60.744683] [] handle_percpu_devid_irq+0x90/0x2b0
[ 60.745165] [] generic_handle_irq+0x34/0x50
[ 60.745594] [] __handle_domain_irq+0x68/0xc0
[ 60.746063] [] gic_handle_irq+0x5c/0xb0
[ 60.748413] [] el1_irq+0xe8/0x18c
[ 60.753505] [] cpuidle_enter_state+0xb8/0x380
[ 60.759046] INFO: rcu_preempt detected stalls on CPUs/tasks:
[ 60.759058] 6-…: (0 ticks this GP) idle=223/140000000000000/0 softirq=9365/9365 fqs=1
[ 60.759080] (detected by 0, t=5252 jiffies, g=1999, c=1998, q=6038)
[ 60.759083] Task dump for CPU 6:
[ 60.759091] kworker/6:0 R running task 0 48 2 0x00000002
[ 60.759106] Workqueue: events tegra_capture_ivc_worker
[ 60.759107] Call trace:
[ 60.759114] [] __switch_to+0x9c/0xc0
[ 60.759117] [] tegra_capture_ivc_worker+0x84/0x108
[ 60.759123] [] process_one_work+0x1e4/0x4b0
[ 60.759127] [] worker_thread+0x50/0x4c8
[ 60.759131] [] kthread+0xec/0xf0
[ 60.759154] [] ret_from_fork+0x10/0x40
[ 60.759159] rcu_preempt kthread starved for 5250 jiffies! g1999 c1998 f0x0 RCU_GP_WAIT_FQS(3) ->state=0x1
[ 60.759164] rcu_preempt S 0 7 2 0x00000000
[ 60.759166] Call trace:
[ 60.759172] [] __switch_to+0x9c/0xc0
[ 60.759180] [] __schedule+0x270/0x780
[ 60.759183] [] schedule+0x40/0xa8
[ 60.759187] [] schedule_timeout+0x88/0x420
[ 60.759192] [] rcu_gp_kthread+0x4a4/0x7d8
[ 60.759196] [] kthread+0xec/0xf0
[ 60.759199] [] ret_from_fork+0x10/0x40
[ 60.767052] INFO: rcu_sched detected stalls on CPUs/tasks:
[ 60.767064] 6-…: (0 ticks this GP) idle=223/140000000000000/0 softirq=9365/9365 fqs=2578
[ 60.767071] (detected by 3, t=5253 jiffies, g=641, c=640, q=98)
[ 60.767073] Task dump for CPU 6:
[ 60.767080] kworker/6:0 R running task 0 48 2 0x00000002
[ 60.767092] Workqueue: events tegra_capture_ivc_worker
[ 60.767093] Call trace:
[ 60.767099] [] __switch_to+0x9c/0xc0
[ 60.767103] [] tegra_capture_ivc_worker+0x84/0x108
[ 60.767107] [] process_one_work+0x1e4/0x4b0
[ 60.767126] [] worker_thread+0x50/0x4c8
[ 60.767130] [] kthread+0xec/0xf0
[ 60.767133] [] ret_from_fork+0x10/0x40
[ 60.956164] [] cpuidle_enter+0x34/0x48
[ 60.956169] [] call_cpuidle+0x44/0x70
[ 60.956172] [] cpu_startup_entry+0x1b0/0x200
[ 60.956191] [] secondary_start_kernel+0x190/0x1f8
[ 60.956194] [<0000000080f5c1a4>] 0x80f5c1a4
[ 60.956199] SMP: stopping secondary CPUs
[ 62.090440] SMP: failed to stop secondary CPUs 5-6
[ 62.090446] Kernel Offset: disabled
[ 62.090448] Memory Limit: none

Have a check below document to add your driver and DT.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fcamera_sensor_prog.html%23