aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2013-10-23 04:59:18 -0400
committerJens Axboe <axboe@kernel.dk>2013-11-08 11:10:28 -0500
commitd2da5b0cb522c48f8e2f311e6e9b212535371b56 (patch)
treeb2d883aa031c9ed894a0dc797400e312226e8251
parent57737adc965e45fcb03662fe6f93f6efb19e2c0a (diff)
drbd: fix decoding of bitmap vli rle for device sizes > 64 TB
Symptoms: disconnect after bitmap exchange due to bitmap overflow (e:49731075554) while decoding bm RLE packet In the decoding step of the variable length integer run length encoding there was potentially an uncatched bitshift by wordsize (variable >> 64). The result of which is "undefined" :( (only "sometimes" the result is the desired 0) Fix: don't do any bit shift magic for shift == 64, just assign. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/block/drbd/drbd_receiver.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 12c59eb3b127..6fa6673b36b3 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4125,7 +4125,11 @@ recv_bm_rle_bits(struct drbd_conf *mdev,
4125 (unsigned int)bs.buf_len); 4125 (unsigned int)bs.buf_len);
4126 return -EIO; 4126 return -EIO;
4127 } 4127 }
4128 look_ahead >>= bits; 4128 /* if we consumed all 64 bits, assign 0; >> 64 is "undefined"; */
4129 if (likely(bits < 64))
4130 look_ahead >>= bits;
4131 else
4132 look_ahead = 0;
4129 have -= bits; 4133 have -= bits;
4130 4134
4131 bits = bitstream_get_bits(&bs, &tmp, 64 - have); 4135 bits = bitstream_get_bits(&bs, &tmp, 64 - have);