@@ -50,7 +50,7 @@ static void warn_setuid_and_fcaps_mixed(const char *fname)
50
50
/**
51
51
* cap_capable - Determine whether a task has a particular effective capability
52
52
* @cred: The credentials to use
53
- * @ns : The user namespace in which we need the capability
53
+ * @targ_ns : The user namespace in which we need the capability
54
54
* @cap: The capability to check for
55
55
* @opts: Bitmask of options defined in include/linux/security.h
56
56
*
@@ -289,7 +289,7 @@ int cap_capset(struct cred *new,
289
289
* affects the security markings on that inode, and if it is, should
290
290
* inode_killpriv() be invoked or the change rejected.
291
291
*
292
- * Returns 1 if security.capability has a value, meaning inode_killpriv()
292
+ * Return: 1 if security.capability has a value, meaning inode_killpriv()
293
293
* is required, 0 otherwise, meaning inode_killpriv() is not required.
294
294
*/
295
295
int cap_inode_need_killpriv (struct dentry * dentry )
@@ -315,7 +315,7 @@ int cap_inode_need_killpriv(struct dentry *dentry)
315
315
* permissions. On non-idmapped mounts or if permission checking is to be
316
316
* performed on the raw inode simply passs init_user_ns.
317
317
*
318
- * Returns 0 if successful, -ve on error.
318
+ * Return: 0 if successful, -ve on error.
319
319
*/
320
320
int cap_inode_killpriv (struct user_namespace * mnt_userns , struct dentry * dentry )
321
321
{
@@ -400,7 +400,7 @@ int cap_inode_getsecurity(struct user_namespace *mnt_userns,
400
400
& tmpbuf , size , GFP_NOFS );
401
401
dput (dentry );
402
402
403
- if (ret < 0 )
403
+ if (ret < 0 || ! tmpbuf )
404
404
return ret ;
405
405
406
406
fs_ns = inode -> i_sb -> s_user_ns ;
@@ -532,7 +532,7 @@ static bool validheader(size_t size, const struct vfs_cap_data *cap)
532
532
* permissions. On non-idmapped mounts or if permission checking is to be
533
533
* performed on the raw inode simply passs init_user_ns.
534
534
*
535
- * If all is ok, we return the new size, on error return < 0.
535
+ * Return: On success, return the new size; on error, return < 0.
536
536
*/
537
537
int cap_convert_nscap (struct user_namespace * mnt_userns , struct dentry * dentry ,
538
538
const void * * ivalue , size_t size )
@@ -881,7 +881,9 @@ static inline bool nonroot_raised_pE(struct cred *new, const struct cred *old,
881
881
*
882
882
* Set up the proposed credentials for a new execution context being
883
883
* constructed by execve(). The proposed creds in @bprm->cred is altered,
884
- * which won't take effect immediately. Returns 0 if successful, -ve on error.
884
+ * which won't take effect immediately.
885
+ *
886
+ * Return: 0 if successful, -ve on error.
885
887
*/
886
888
int cap_bprm_creds_from_file (struct linux_binprm * bprm , struct file * file )
887
889
{
@@ -1117,7 +1119,9 @@ static inline void cap_emulate_setxuid(struct cred *new, const struct cred *old)
1117
1119
* @flags: Indications of what has changed
1118
1120
*
1119
1121
* Fix up the results of setuid() call before the credential changes are
1120
- * actually applied, returning 0 to grant the changes, -ve to deny them.
1122
+ * actually applied.
1123
+ *
1124
+ * Return: 0 to grant the changes, -ve to deny them.
1121
1125
*/
1122
1126
int cap_task_fix_setuid (struct cred * new , const struct cred * old , int flags )
1123
1127
{
@@ -1187,33 +1191,39 @@ static int cap_safe_nice(struct task_struct *p)
1187
1191
* @p: The task to affect
1188
1192
*
1189
1193
* Detemine if the requested scheduler policy change is permitted for the
1190
- * specified task, returning 0 if permission is granted, -ve if denied.
1194
+ * specified task.
1195
+ *
1196
+ * Return: 0 if permission is granted, -ve if denied.
1191
1197
*/
1192
1198
int cap_task_setscheduler (struct task_struct * p )
1193
1199
{
1194
1200
return cap_safe_nice (p );
1195
1201
}
1196
1202
1197
1203
/**
1198
- * cap_task_ioprio - Detemine if I/O priority change is permitted
1204
+ * cap_task_setioprio - Detemine if I/O priority change is permitted
1199
1205
* @p: The task to affect
1200
1206
* @ioprio: The I/O priority to set
1201
1207
*
1202
1208
* Detemine if the requested I/O priority change is permitted for the specified
1203
- * task, returning 0 if permission is granted, -ve if denied.
1209
+ * task.
1210
+ *
1211
+ * Return: 0 if permission is granted, -ve if denied.
1204
1212
*/
1205
1213
int cap_task_setioprio (struct task_struct * p , int ioprio )
1206
1214
{
1207
1215
return cap_safe_nice (p );
1208
1216
}
1209
1217
1210
1218
/**
1211
- * cap_task_ioprio - Detemine if task priority change is permitted
1219
+ * cap_task_setnice - Detemine if task priority change is permitted
1212
1220
* @p: The task to affect
1213
1221
* @nice: The nice value to set
1214
1222
*
1215
1223
* Detemine if the requested task priority change is permitted for the
1216
- * specified task, returning 0 if permission is granted, -ve if denied.
1224
+ * specified task.
1225
+ *
1226
+ * Return: 0 if permission is granted, -ve if denied.
1217
1227
*/
1218
1228
int cap_task_setnice (struct task_struct * p , int nice )
1219
1229
{
@@ -1243,12 +1253,15 @@ static int cap_prctl_drop(unsigned long cap)
1243
1253
/**
1244
1254
* cap_task_prctl - Implement process control functions for this security module
1245
1255
* @option: The process control function requested
1246
- * @arg2, @arg3, @arg4, @arg5: The argument data for this function
1256
+ * @arg2: The argument data for this function
1257
+ * @arg3: The argument data for this function
1258
+ * @arg4: The argument data for this function
1259
+ * @arg5: The argument data for this function
1247
1260
*
1248
1261
* Allow process control functions (sys_prctl()) to alter capabilities; may
1249
1262
* also deny access to other functions not otherwise implemented here.
1250
1263
*
1251
- * Returns 0 or +ve on success, -ENOSYS if this function is not implemented
1264
+ * Return: 0 or +ve on success, -ENOSYS if this function is not implemented
1252
1265
* here, other -ve on error. If -ENOSYS is returned, sys_prctl() and other LSM
1253
1266
* modules will consider performing the function.
1254
1267
*/
@@ -1383,7 +1396,9 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
1383
1396
* @pages: The size of the mapping
1384
1397
*
1385
1398
* Determine whether the allocation of a new virtual mapping by the current
1386
- * task is permitted, returning 1 if permission is granted, 0 if not.
1399
+ * task is permitted.
1400
+ *
1401
+ * Return: 1 if permission is granted, 0 if not.
1387
1402
*/
1388
1403
int cap_vm_enough_memory (struct mm_struct * mm , long pages )
1389
1404
{
@@ -1396,14 +1411,15 @@ int cap_vm_enough_memory(struct mm_struct *mm, long pages)
1396
1411
return cap_sys_admin ;
1397
1412
}
1398
1413
1399
- /*
1414
+ /**
1400
1415
* cap_mmap_addr - check if able to map given addr
1401
1416
* @addr: address attempting to be mapped
1402
1417
*
1403
1418
* If the process is attempting to map memory below dac_mmap_min_addr they need
1404
1419
* CAP_SYS_RAWIO. The other parameters to this function are unused by the
1405
- * capability security module. Returns 0 if this mapping should be allowed
1406
- * -EPERM if not.
1420
+ * capability security module.
1421
+ *
1422
+ * Return: 0 if this mapping should be allowed or -EPERM if not.
1407
1423
*/
1408
1424
int cap_mmap_addr (unsigned long addr )
1409
1425
{
0 commit comments