@@ -394,7 +394,7 @@ copy_msqid_from_user(struct msqid64_ds *out, void __user *buf, int version)
394
394
* NOTE: no locks must be held, the rwsem is taken inside this function.
395
395
*/
396
396
static int msgctl_down (struct ipc_namespace * ns , int msqid , int cmd ,
397
- struct msqid64_ds * msqid64 )
397
+ struct ipc64_perm * perm , int msg_qbytes )
398
398
{
399
399
struct kern_ipc_perm * ipcp ;
400
400
struct msg_queue * msq ;
@@ -404,7 +404,7 @@ static int msgctl_down(struct ipc_namespace *ns, int msqid, int cmd,
404
404
rcu_read_lock ();
405
405
406
406
ipcp = ipcctl_obtain_check (ns , & msg_ids (ns ), msqid , cmd ,
407
- & msqid64 -> msg_perm , msqid64 -> msg_qbytes );
407
+ perm , msg_qbytes );
408
408
if (IS_ERR (ipcp )) {
409
409
err = PTR_ERR (ipcp );
410
410
goto out_unlock1 ;
@@ -426,18 +426,18 @@ static int msgctl_down(struct ipc_namespace *ns, int msqid, int cmd,
426
426
{
427
427
DEFINE_WAKE_Q (wake_q );
428
428
429
- if (msqid64 -> msg_qbytes > ns -> msg_ctlmnb &&
429
+ if (msg_qbytes > ns -> msg_ctlmnb &&
430
430
!capable (CAP_SYS_RESOURCE )) {
431
431
err = - EPERM ;
432
432
goto out_unlock1 ;
433
433
}
434
434
435
435
ipc_lock_object (& msq -> q_perm );
436
- err = ipc_update_perm (& msqid64 -> msg_perm , ipcp );
436
+ err = ipc_update_perm (perm , ipcp );
437
437
if (err )
438
438
goto out_unlock0 ;
439
439
440
- msq -> q_qbytes = msqid64 -> msg_qbytes ;
440
+ msq -> q_qbytes = msg_qbytes ;
441
441
442
442
msq -> q_ctime = ktime_get_real_seconds ();
443
443
/*
@@ -618,9 +618,10 @@ static long ksys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf, int ver
618
618
case IPC_SET :
619
619
if (copy_msqid_from_user (& msqid64 , buf , version ))
620
620
return - EFAULT ;
621
- /* fallthru */
621
+ return msgctl_down (ns , msqid , cmd , & msqid64 .msg_perm ,
622
+ msqid64 .msg_qbytes );
622
623
case IPC_RMID :
623
- return msgctl_down (ns , msqid , cmd , & msqid64 );
624
+ return msgctl_down (ns , msqid , cmd , NULL , 0 );
624
625
default :
625
626
return - EINVAL ;
626
627
}
@@ -752,9 +753,9 @@ static long compat_ksys_msgctl(int msqid, int cmd, void __user *uptr, int versio
752
753
case IPC_SET :
753
754
if (copy_compat_msqid_from_user (& msqid64 , uptr , version ))
754
755
return - EFAULT ;
755
- /* fallthru */
756
+ return msgctl_down ( ns , msqid , cmd , & msqid64 . msg_perm , msqid64 . msg_qbytes );
756
757
case IPC_RMID :
757
- return msgctl_down (ns , msqid , cmd , & msqid64 );
758
+ return msgctl_down (ns , msqid , cmd , NULL , 0 );
758
759
default :
759
760
return - EINVAL ;
760
761
}
0 commit comments