@@ -918,17 +918,12 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name)
918
918
* The same algorithm is used for senders.
919
919
*/
920
920
921
- /* pipelined_send() - send a message directly to the task waiting in
922
- * sys_mq_timedreceive() (without inserting message into a queue).
923
- */
924
- static inline void pipelined_send (struct wake_q_head * wake_q ,
921
+ static inline void __pipelined_op (struct wake_q_head * wake_q ,
925
922
struct mqueue_inode_info * info ,
926
- struct msg_msg * message ,
927
- struct ext_wait_queue * receiver )
923
+ struct ext_wait_queue * this )
928
924
{
929
- receiver -> msg = message ;
930
- list_del (& receiver -> list );
931
- wake_q_add (wake_q , receiver -> task );
925
+ list_del (& this -> list );
926
+ wake_q_add (wake_q , this -> task );
932
927
/*
933
928
* Rely on the implicit cmpxchg barrier from wake_q_add such
934
929
* that we can ensure that updating receiver->state is the last
@@ -937,7 +932,19 @@ static inline void pipelined_send(struct wake_q_head *wake_q,
937
932
* yet, at that point we can later have a use-after-free
938
933
* condition and bogus wakeup.
939
934
*/
940
- receiver -> state = STATE_READY ;
935
+ this -> state = STATE_READY ;
936
+ }
937
+
938
+ /* pipelined_send() - send a message directly to the task waiting in
939
+ * sys_mq_timedreceive() (without inserting message into a queue).
940
+ */
941
+ static inline void pipelined_send (struct wake_q_head * wake_q ,
942
+ struct mqueue_inode_info * info ,
943
+ struct msg_msg * message ,
944
+ struct ext_wait_queue * receiver )
945
+ {
946
+ receiver -> msg = message ;
947
+ __pipelined_op (wake_q , info , receiver );
941
948
}
942
949
943
950
/* pipelined_receive() - if there is task waiting in sys_mq_timedsend()
@@ -955,9 +962,7 @@ static inline void pipelined_receive(struct wake_q_head *wake_q,
955
962
if (msg_insert (sender -> msg , info ))
956
963
return ;
957
964
958
- list_del (& sender -> list );
959
- wake_q_add (wake_q , sender -> task );
960
- sender -> state = STATE_READY ;
965
+ __pipelined_op (wake_q , info , sender );
961
966
}
962
967
963
968
static int do_mq_timedsend (mqd_t mqdes , const char __user * u_msg_ptr ,
0 commit comments