mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
nvmf: Fail pass through commands while a controller is not associated
Previously this just dereferenced NULL qp pointers and panicked. Instead, use a shared lock on the connection lock to protect access to the qp pointers and allocate a request. If the controller is not associated, fail the request with ECONNABORTED. Possibly this should be honoring kern.nvmf.fail_on_disconnection and block waiting for a reconnect request while disconnected if that tunable is false. Reported by: Suhas Lokesha <suhas@chelsio.com> Sponsored by: Chelsio Communications
This commit is contained in:
parent
b08d332da0
commit
d1516ec33e
1 changed files with 9 additions and 0 deletions
|
|
@ -972,12 +972,21 @@ nvmf_passthrough_cmd(struct nvmf_softc *sc, struct nvme_pt_command *pt,
|
|||
cmd.cdw14 = pt->cmd.cdw14;
|
||||
cmd.cdw15 = pt->cmd.cdw15;
|
||||
|
||||
sx_slock(&sc->connection_lock);
|
||||
if (sc->admin == NULL || sc->detaching) {
|
||||
device_printf(sc->dev,
|
||||
"failed to send passthrough command\n");
|
||||
error = ECONNABORTED;
|
||||
sx_sunlock(&sc->connection_lock);
|
||||
goto error;
|
||||
}
|
||||
if (admin)
|
||||
qp = sc->admin;
|
||||
else
|
||||
qp = nvmf_select_io_queue(sc);
|
||||
nvmf_status_init(&status);
|
||||
req = nvmf_allocate_request(qp, &cmd, nvmf_complete, &status, M_WAITOK);
|
||||
sx_sunlock(&sc->connection_lock);
|
||||
if (req == NULL) {
|
||||
device_printf(sc->dev, "failed to send passthrough command\n");
|
||||
error = ECONNABORTED;
|
||||
|
|
|
|||
Loading…
Reference in a new issue