]> git.baikalelectronics.ru Git - kernel.git/commit
ceph: avoid divide by zero in __validate_layout()
authorSage Weil <sage@inktank.com>
Tue, 21 Aug 2012 19:11:51 +0000 (12:11 -0700)
committerSage Weil <sage@inktank.com>
Tue, 21 Aug 2012 22:55:28 +0000 (15:55 -0700)
commitb65c6c17c3319abf1b5b21bf1948bf75c1f64efe
tree0335f7ad27ed8506504201a5e558126b2ede058f
parent09bb2b7e889c25510f5d6b22f38ff39419939c50
ceph: avoid divide by zero in __validate_layout()

If "l->stripe_unit" is zero the the mod on the next line will cause a
divide by zero bug.  This comes from the copy_from_user() in
ceph_ioctl_set_layout_policy().  Passing 0 is valid, though (it means
"do not change") so avoid the % check in that case.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Alex Elder <elder@inktank.com>
fs/ceph/ioctl.c