refactor GRil incoming bytes dispatching mechanism
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ofono (Ubuntu) |
Won't Fix
|
Low
|
You-Sheng Yang |
Bug Description
GRil reads incoming bytes into ril_msg structure in function `read_fixed_record` in gril/gril.c. It's mostly working except it makes some assumptions that are not always true.
1. The `read_fixed_record` function calls `memmove` to copy data from ring_buffer, which follows that the whole parcel must not be wrapped. This is usually true because whenever a parcel is read, the ring_buffer rewind its in/out position markers to the beginning. However, if somehow rild transmits massive amount of parcels, or due to various reasons that the gio thread is not waked up in time and a lot of incoming data queued in kernel, then a parcel that spans across the boundary becomes very likely. This is actually the question raised in the comment:
/* TODO: need to better understand how wrap works! */
With https:/
2. One should really avoid using ring_buffer APIs that involve its internal states. Ring buffer wrapping should not be a concern to other components whenever possible.
Changed in ofono (Ubuntu): | |
status: | New → In Progress |
importance: | Undecided → Low |
Changed in ofono (Ubuntu): | |
status: | In Progress → Won't Fix |
proposed pull request https:/ /github. com/rilmodem/ ofono/pull/ 149