Actions
Bug #7985
closedvioif handles allocation error in attach incorrectly
Start date:
2017-03-20
Due date:
% Done:
100%
Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
Description
While reading the code I noticed the following snippet:
sc->sc_rx_vq = virtio_alloc_vq(&sc->sc_virtio, 0,
VIOIF_RX_QLEN, VIOIF_INDIRECT_MAX, "rx");
if (!sc->sc_rx_vq)
goto exit_alloc1;
virtio_stop_vq_intr(sc->sc_rx_vq);
sc->sc_tx_vq = virtio_alloc_vq(&sc->sc_virtio, 1,
VIOIF_TX_QLEN, VIOIF_INDIRECT_MAX, "tx");
if (!sc->sc_rx_vq) /* <--------------------- ISSUE HERE */
goto exit_alloc2;
virtio_stop_vq_intr(sc->sc_tx_vq);
I'm guessing this was a copy and paste error. The goto exit_alloc2 is actually unreachable because the conditional checks for a failure that's already been exited for.
By the way I know this source file was modeled after the NetBSD code. I've tracked down the equivalent NetBSD file, and it looks like they've diverged enough not to have this (exact) issue.
Updated by Electric Monk about 5 years ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100
git commit 0062e03dc6d700fc8eaaf8174448181babab8179
commit 0062e03dc6d700fc8eaaf8174448181babab8179 Author: Dillon Amburgey <dillona@dillona.com> Date: 2017-03-27T15:42:16.000Z 7985 vioif handles allocation error in attach incorrectly Reviewed by: Jason King <jason.brian.king@gmail.com> Approved by: Robert Mustacchi <rm@joyent.com>
Actions