Change lov_iocontrol(), lmv_iocontrol() and mdc_iocontrol() functions to copy UUID
string into a buffer before calling *_statfs() functions, so that UUID is
always set when returning to the caller
i=andreas.dilger
i=nathan.rutman
if (!mdc_obd)
RETURN(-EINVAL);
+ /* copy UUID */
+ if (cfs_copy_to_user(data->ioc_pbuf2, obd2cli_tgt(mdc_obd),
+ min((int) data->ioc_plen2,
+ (int) sizeof(struct obd_uuid))))
+ RETURN(-EFAULT);
+
rc = obd_statfs(mdc_obd, &stat_buf,
cfs_time_current_64() - CFS_HZ, 0);
if (rc)
RETURN(rc);
if (cfs_copy_to_user(data->ioc_pbuf1, &stat_buf,
- data->ioc_plen1))
- RETURN(-EFAULT);
- if (cfs_copy_to_user(data->ioc_pbuf2, obd2cli_tgt(mdc_obd),
- data->ioc_plen2))
+ min((int) data->ioc_plen1,
+ (int) sizeof(stat_buf))))
RETURN(-EFAULT);
break;
}
if (!osc_obd)
RETURN(-EINVAL);
+ /* copy UUID */
+ if (cfs_copy_to_user(data->ioc_pbuf2, obd2cli_tgt(osc_obd),
+ min((int) data->ioc_plen2,
+ (int) sizeof(struct obd_uuid))))
+ RETURN(-EFAULT);
+
/* got statfs data */
rc = obd_statfs(osc_obd, &stat_buf,
cfs_time_current_64() - CFS_HZ, 0);
if (rc)
RETURN(rc);
if (cfs_copy_to_user(data->ioc_pbuf1, &stat_buf,
- data->ioc_plen1))
- RETURN(-EFAULT);
- /* copy UUID */
- if (cfs_copy_to_user(data->ioc_pbuf2, obd2cli_tgt(osc_obd),
- data->ioc_plen2))
+ min((int) data->ioc_plen1,
+ (int) sizeof(stat_buf))))
RETURN(-EFAULT);
break;
}
if (*((__u32 *) data->ioc_inlbuf2) != 0)
GOTO(out, rc = -ENODEV);
+ /* copy UUID */
+ if (cfs_copy_to_user(data->ioc_pbuf2, obd2cli_tgt(obd),
+ min((int) data->ioc_plen2,
+ (int) sizeof(struct obd_uuid))))
+ GOTO(out, rc = -EFAULT);
+
rc = mdc_statfs(obd, &stat_buf,
cfs_time_current_64() - CFS_HZ, 0);
if (rc != 0)
GOTO(out, rc);
if (cfs_copy_to_user(data->ioc_pbuf1, &stat_buf,
- data->ioc_plen1))
- GOTO(out, rc = -EFAULT);
- if (cfs_copy_to_user(data->ioc_pbuf2, obd2cli_tgt(obd),
- data->ioc_plen2))
+ min((int) data->ioc_plen1,
+ (int) sizeof(stat_buf))))
GOTO(out, rc = -EFAULT);
GOTO(out, rc = 0);