From: Alex Elder Date: Thu, 11 Oct 2012 04:19:13 +0000 (-0700) Subject: rbd: fix bug in rbd_dev_id_put() X-Git-Tag: v3.7.3~17 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=38f14fd492d3a7d2d096795f2e457d556a6b2f95;p=karo-tx-linux.git rbd: fix bug in rbd_dev_id_put() (cherry picked from commit b213e0b1a62637b2a9395a34349b13d73ca2b90a) In rbd_dev_id_put(), there's a loop that's intended to determine the maximum device id in use. But it isn't doing that at all, the effect of how it's written is to simply use the just-put id number, which ignores whole purpose of this function. Fix the bug. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index bb3d9be3b1b4..37d928f573e4 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2621,8 +2621,8 @@ static void rbd_dev_id_put(struct rbd_device *rbd_dev) struct rbd_device *rbd_dev; rbd_dev = list_entry(tmp, struct rbd_device, node); - if (rbd_id > max_id) - max_id = rbd_id; + if (rbd_dev->dev_id > max_id) + max_id = rbd_dev->dev_id; } spin_unlock(&rbd_dev_list_lock);