aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/random.c')
-rw-r--r--drivers/char/random.c42
1 files changed, 1 insertions, 41 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 04b505e5a5e2..bcf680f9ff58 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1257,40 +1257,9 @@ static int proc_do_uuid(ctl_table *table, int write,
1257 return proc_dostring(&fake_table, write, buffer, lenp, ppos); 1257 return proc_dostring(&fake_table, write, buffer, lenp, ppos);
1258} 1258}
1259 1259
1260static int uuid_strategy(ctl_table *table,
1261 void __user *oldval, size_t __user *oldlenp,
1262 void __user *newval, size_t newlen)
1263{
1264 unsigned char tmp_uuid[16], *uuid;
1265 unsigned int len;
1266
1267 if (!oldval || !oldlenp)
1268 return 1;
1269
1270 uuid = table->data;
1271 if (!uuid) {
1272 uuid = tmp_uuid;
1273 uuid[8] = 0;
1274 }
1275 if (uuid[8] == 0)
1276 generate_random_uuid(uuid);
1277
1278 if (get_user(len, oldlenp))
1279 return -EFAULT;
1280 if (len) {
1281 if (len > 16)
1282 len = 16;
1283 if (copy_to_user(oldval, uuid, len) ||
1284 put_user(len, oldlenp))
1285 return -EFAULT;
1286 }
1287 return 1;
1288}
1289
1290static int sysctl_poolsize = INPUT_POOL_WORDS * 32; 1260static int sysctl_poolsize = INPUT_POOL_WORDS * 32;
1291ctl_table random_table[] = { 1261ctl_table random_table[] = {
1292 { 1262 {
1293 .ctl_name = RANDOM_POOLSIZE,
1294 .procname = "poolsize", 1263 .procname = "poolsize",
1295 .data = &sysctl_poolsize, 1264 .data = &sysctl_poolsize,
1296 .maxlen = sizeof(int), 1265 .maxlen = sizeof(int),
@@ -1298,7 +1267,6 @@ ctl_table random_table[] = {
1298 .proc_handler = &proc_dointvec, 1267 .proc_handler = &proc_dointvec,
1299 }, 1268 },
1300 { 1269 {
1301 .ctl_name = RANDOM_ENTROPY_COUNT,
1302 .procname = "entropy_avail", 1270 .procname = "entropy_avail",
1303 .maxlen = sizeof(int), 1271 .maxlen = sizeof(int),
1304 .mode = 0444, 1272 .mode = 0444,
@@ -1306,45 +1274,37 @@ ctl_table random_table[] = {
1306 .data = &input_pool.entropy_count, 1274 .data = &input_pool.entropy_count,
1307 }, 1275 },
1308 { 1276 {
1309 .ctl_name = RANDOM_READ_THRESH,
1310 .procname = "read_wakeup_threshold", 1277 .procname = "read_wakeup_threshold",
1311 .data = &random_read_wakeup_thresh, 1278 .data = &random_read_wakeup_thresh,
1312 .maxlen = sizeof(int), 1279 .maxlen = sizeof(int),
1313 .mode = 0644, 1280 .mode = 0644,
1314 .proc_handler = &proc_dointvec_minmax, 1281 .proc_handler = &proc_dointvec_minmax,
1315 .strategy = &sysctl_intvec,
1316 .extra1 = &min_read_thresh, 1282 .extra1 = &min_read_thresh,
1317 .extra2 = &max_read_thresh, 1283 .extra2 = &max_read_thresh,
1318 }, 1284 },
1319 { 1285 {
1320 .ctl_name = RANDOM_WRITE_THRESH,
1321 .procname = "write_wakeup_threshold", 1286 .procname = "write_wakeup_threshold",
1322 .data = &random_write_wakeup_thresh, 1287 .data = &random_write_wakeup_thresh,
1323 .maxlen = sizeof(int), 1288 .maxlen = sizeof(int),
1324 .mode = 0644, 1289 .mode = 0644,
1325 .proc_handler = &proc_dointvec_minmax, 1290 .proc_handler = &proc_dointvec_minmax,
1326 .strategy = &sysctl_intvec,
1327 .extra1 = &min_write_thresh, 1291 .extra1 = &min_write_thresh,
1328 .extra2 = &max_write_thresh, 1292 .extra2 = &max_write_thresh,
1329 }, 1293 },
1330 { 1294 {
1331 .ctl_name = RANDOM_BOOT_ID,
1332 .procname = "boot_id", 1295 .procname = "boot_id",
1333 .data = &sysctl_bootid, 1296 .data = &sysctl_bootid,
1334 .maxlen = 16, 1297 .maxlen = 16,
1335 .mode = 0444, 1298 .mode = 0444,
1336 .proc_handler = &proc_do_uuid, 1299 .proc_handler = &proc_do_uuid,
1337 .strategy = &uuid_strategy,
1338 }, 1300 },
1339 { 1301 {
1340 .ctl_name = RANDOM_UUID,
1341 .procname = "uuid", 1302 .procname = "uuid",
1342 .maxlen = 16, 1303 .maxlen = 16,
1343 .mode = 0444, 1304 .mode = 0444,
1344 .proc_handler = &proc_do_uuid, 1305 .proc_handler = &proc_do_uuid,
1345 .strategy = &uuid_strategy,
1346 }, 1306 },
1347 { .ctl_name = 0 } 1307 { }
1348}; 1308};
1349#endif /* CONFIG_SYSCTL */ 1309#endif /* CONFIG_SYSCTL */
1350 1310