]> git.karo-electronics.de Git - linux-beck.git/commitdiff
md/raid5-cache: use ring add to prevent overflow
authorJackieLiu <liuyun01@kylinos.cn>
Mon, 28 Nov 2016 08:19:19 +0000 (16:19 +0800)
committerShaohua Li <shli@fb.com>
Tue, 29 Nov 2016 22:46:21 +0000 (14:46 -0800)
'write_pos' must be protected with 'r5l_ring_add', or it may overflow

Signed-off-by: JackieLiu <liuyun01@kylinos.cn>
Reviewed-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid5-cache.c

index 1842ecbf95a10acd69f69d86681ca78aa4ca217a..5ef20c57731fea83240417f37722483de8cc232e 100644 (file)
@@ -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];