usb: gadget: Enable sg support explicitly at function driver level
Currently u_ether is relying on gadget sg_support flag to allocate
memory for scatter/gather related data structures. These memory
pointers are stored in usb_request structure members. In case a
function driver does not support scatter/gather, usb_request members
are overwritten in eth_start_xmit() because function driver sg_enabled
flag is set to false. This resulting into memory leak. Similarly when
function driver level sg support is disabled, req->context saves skb
pointer in eth_start_xmit() which gets freed in tx_complete(). If
disconnect happens at this point same skb is freed again in
gether_disconnect() because gether_disconnect() relies on gadget
sg_support flag to free req->contex. Hence remove gadget sg_support
flag from u_ether completly and only rely on function driver level
sg_enabled flag to allocate and free memory. This requires all the
functions supporting scatter/gather to explicitly call
gether_enable_sg() to enable scatter/gather support.
CRs-Fixed: 763062
Change-Id: I4d0caad4112cf01d258c531b64b13292b3817317
Signed-off-by:
Hemant Kumar <hemantk@codeaurora.org>
Loading
Please register or sign in to comment