From fc833c2a2f4129c42efdaed64b9eb6e9ae5fdcee Mon Sep 17 00:00:00 2001 From: JackieLiu Date: Mon, 28 Nov 2016 16:19:19 +0800 Subject: [PATCH] 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 --- drivers/md/raid5-cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]; -- GitLab