Skip to content

Commit

Permalink
md/raid5: fix raid5_set_bi_hw_segments
Browse files Browse the repository at this point in the history
The @bio->bi_phys_segments consists of active stripes count in the
lower 16 bits and processed stripes count in the upper 16 bits. So
logical-OR operator should be bitwise one.

This bug has been present since 2.6.27 and the fix is suitable for any
-stable kernel since then.  Fortunately the bad code is only used on
error paths and is relatively unlikely to be hit.

Cc: stable@kernel.org
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
Namhyung Kim authored and NeilBrown committed Jun 14, 2011
1 parent f699bf2 commit 9b2dc8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static inline int raid5_dec_bi_hw_segments(struct bio *bio)

static inline void raid5_set_bi_hw_segments(struct bio *bio, unsigned int cnt)
{
bio->bi_phys_segments = raid5_bi_phys_segments(bio) || (cnt << 16);
bio->bi_phys_segments = raid5_bi_phys_segments(bio) | (cnt << 16);
}

/* Find first data disk in a raid6 stripe */
Expand Down

0 comments on commit 9b2dc8b

Please sign in to comment.