diff options
author | Tejun Heo <tj@kernel.org> | 2019-10-15 18:49:27 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-10-29 11:20:09 +0300 |
commit | 054441182b51beca00f0c639b0119a1995143772 (patch) | |
tree | c1f9e30a37ee15118017cd8a2d5319f50c107896 /block/blk-rq-qos.h | |
parent | 2ada40308a0db8332ede32e274c54a08efe7ff52 (diff) | |
download | linux-054441182b51beca00f0c639b0119a1995143772.tar.xz |
blk-rq-qos: fix first node deletion of rq_qos_del()
commit 307f4065b9d7c1e887e8bdfb2487e4638559fea1 upstream.
rq_qos_del() incorrectly assigns the node being deleted to the head if
it was the first on the list in the !prev path. Fix it by iterating
with ** instead.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>
Fixes: a79050434b45 ("blk-rq-qos: refactor out common elements of blk-wbt")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block/blk-rq-qos.h')
-rw-r--r-- | block/blk-rq-qos.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h index 60fac2d066cf..98caba3e962e 100644 --- a/block/blk-rq-qos.h +++ b/block/blk-rq-qos.h @@ -80,16 +80,13 @@ static inline void rq_qos_add(struct request_queue *q, struct rq_qos *rqos) static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos) { - struct rq_qos *cur, *prev = NULL; - for (cur = q->rq_qos; cur; cur = cur->next) { - if (cur == rqos) { - if (prev) - prev->next = rqos->next; - else - q->rq_qos = cur; + struct rq_qos **cur; + + for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) { + if (*cur == rqos) { + *cur = rqos->next; break; } - prev = cur; } } |