pnfs: validate stripe unit and count to prevent div/0
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
bf53e3dc1a
commit
49f141680a
1 changed files with 6 additions and 0 deletions
|
|
@ -972,6 +972,12 @@ enum pnfs_status pnfs_layout_io_start(
|
||||||
/* don't start any more io if the layout has been recalled */
|
/* don't start any more io if the layout has been recalled */
|
||||||
status = PNFSERR_LAYOUT_RECALLED;
|
status = PNFSERR_LAYOUT_RECALLED;
|
||||||
dprintf(FLLVL, "pnfs_layout_io_start() failed, layout was recalled\n");
|
dprintf(FLLVL, "pnfs_layout_io_start() failed, layout was recalled\n");
|
||||||
|
} else if (layout_unit_size(state->layout) == 0) { /* prevent div/0 */
|
||||||
|
status = PNFSERR_NO_LAYOUT;
|
||||||
|
} else if (state->layout->device->stripes.count == 0) {
|
||||||
|
status = PNFSERR_NO_LAYOUT;
|
||||||
|
} else if (state->layout->device->servers.count == 0) {
|
||||||
|
status = PNFSERR_NO_LAYOUT;
|
||||||
} else {
|
} else {
|
||||||
/* take a reference on the layout, so that it won't be recalled
|
/* take a reference on the layout, so that it won't be recalled
|
||||||
* until all io is finished */
|
* until all io is finished */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue