hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/infiniband/core/uverbs_main.c
....@@ -222,8 +222,12 @@
222222 spin_lock_irq(&ev_queue->lock);
223223
224224 while (list_empty(&ev_queue->event_list)) {
225
- spin_unlock_irq(&ev_queue->lock);
225
+ if (ev_queue->is_closed) {
226
+ spin_unlock_irq(&ev_queue->lock);
227
+ return -EIO;
228
+ }
226229
230
+ spin_unlock_irq(&ev_queue->lock);
227231 if (filp->f_flags & O_NONBLOCK)
228232 return -EAGAIN;
229233
....@@ -233,12 +237,6 @@
233237 return -ERESTARTSYS;
234238
235239 spin_lock_irq(&ev_queue->lock);
236
-
237
- /* If device was disassociated and no event exists set an error */
238
- if (list_empty(&ev_queue->event_list) && ev_queue->is_closed) {
239
- spin_unlock_irq(&ev_queue->lock);
240
- return -EIO;
241
- }
242240 }
243241
244242 event = list_entry(ev_queue->event_list.next, struct ib_uverbs_event, list);
....@@ -537,7 +535,7 @@
537535 if (hdr->in_words * 4 != count)
538536 return -EINVAL;
539537
540
- if (count < method_elm->req_size + sizeof(hdr)) {
538
+ if (count < method_elm->req_size + sizeof(*hdr)) {
541539 /*
542540 * rdma-core v18 and v19 have a bug where they send DESTROY_CQ
543541 * with a 16 byte write instead of 24. Old kernels didn't