From: JackieLiu Date: Mon, 28 Nov 2016 08:19:19 +0000 (+0800) Subject: md/raid5-cache: use ring add to prevent overflow X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fc833c2a2f4129c42efdaed64b9eb6e9ae5fdcee;p=linux-beck.git md/raid5-cache: use ring add to prevent overflow 'write_pos' must be protected with 'r5l_ring_add', or it may overflow Signed-off-by: JackieLiu Reviewed-by: Song Liu Signed-off-by: Shaohua Li --- diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 1842ecbf95a1..5ef20c57731f 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c @@ -2084,7 +2084,7 @@ r5c_recovery_rewrite_data_only_stripes(struct r5l_log *log, ctx->pos, ctx->seq); mb = page_address(page); offset = le32_to_cpu(mb->meta_size); - write_pos = ctx->pos + BLOCK_SECTORS; + write_pos = r5l_ring_add(log, ctx->pos, BLOCK_SECTORS); for (i = sh->disks; i--; ) { struct r5dev *dev = &sh->dev[i];