mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
scsi: qedi: Initialize callback state before registration
qedi_get_protocol_tlv_data() can be called asynchronously by QED after
qedi_ops->register_ops(). It takes stats_lock and reads ll2_mtu, but
__qedi_probe() currently registers the callback before initializing the
mutex and assigning the default MTU on the normal probe path.
Initialize the callback-visible state before registering qedi_cb_ops. Keep
the recovery path from reinitializing state because it reuses the existing
qedi context.
Fixes: 3cc5746e5a ("scsi: qedi: Initialize the stats mutex lock")
Cc: [email protected]
Assisted-by: LLM Codex
Signed-off-by: Runyu Xiao <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Martin K. Petersen (Oracle) <[email protected]>
This commit is contained in:
1 parent
02a3178319
commit
85de8b3a5e
1 file changed
+1
-2
@@ -2652,8 +2652,6 @@ retry_probe:
|
||||
snprintf(host_buf, sizeof(host_buf), "host_%d", qedi->shost->host_no);
|
||||
qedi_ops->common->set_name(qedi->cdev, host_buf);
|
||||
|
||||
qedi_ops->register_ops(qedi->cdev, &qedi_cb_ops, qedi);
|
||||
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
params.mtu = DEF_PATH_MTU + IPV6_HDR_LEN + TCP_HDR_LEN;
|
||||
qedi->ll2_mtu = DEF_PATH_MTU;
|
||||
@@ -2670,6 +2668,7 @@ retry_probe:
|
||||
spin_lock_init(&qedi->task_idx_lock);
|
||||
mutex_init(&qedi->stats_lock);
|
||||
}
|
||||
qedi_ops->register_ops(qedi->cdev, &qedi_cb_ops, qedi);
|
||||
qedi_ops->ll2->register_cb_ops(qedi->cdev, &qedi_ll2_cb_ops, qedi);
|
||||
qedi_ops->ll2->start(qedi->cdev, ¶ms);
|
||||
|
||||
|
||||
Reference in new issue
Block a user