In ib_umad_read, there is currently (or soon to be something like) the following: ... packet = list_entry(file->recv_list.next, struct ib_umad_packet, list); list_del(&packet->list);
spin_unlock_irq(&file->recv_lock);
if (copy_to_user(buf, &packet->mad, min(count, packet->length + sizeof (struct ib_user_mad)))) ret = -EFAULT; else ret = count;
kfree(packet); return ret;
Should the packet be thrown away because copy_to_user() fails ? Shouldn't it be placed back at the head of the list ? Unfortunately, that would mean holding the recv lock longer (through the duration of copy_to_user).
In the failure case, could you just re-acquire the lock and insert the packet at the head of the list? Even if this results in reading MADs out of order, I wouldn't think that this would matter.
- Sean _______________________________________________ openib-general mailing list [email protected] http://openib.org/mailman/listinfo/openib-general
To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
