Skip to content

Commit

Permalink
s390/dasd: fix possible buffer overflow in copy_pair_show
Browse files Browse the repository at this point in the history
dasd_copy_relation->entry[] array might be accessed out of bounds if the
loop does not break.

Fixes: a91ff09 ("s390/dasd: add copy pair setup")
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Link: https://lore.kernel.org/r/20221123160719.3002694-5-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Stefan Haberland authored and Jens Axboe committed Nov 23, 2022
1 parent 590ce6d commit 7e8a05b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/s390/block/dasd_devmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ dasd_copy_pair_show(struct device *dev,
break;
}
}
if (!copy->entry[i].primary)
if (i == DASD_CP_ENTRIES)
goto out;

/* print all secondary */
Expand Down

0 comments on commit 7e8a05b

Please sign in to comment.