ANDROID: fix up rndis ABI breakage
Commit4ce247af3f
("usb: gadget: rndis: add spinlock for rndis response list") broke the rndis abi by adding a lock to the device structure. This is the correct thing to do, to resolve an issue, but work around this by moving the lock to be a one-lock-per-driver instead of a per-device lock. This matches the first submission of this commit, so it still resolves the same problem, while preserving the ABI for now. Bug: 161946584 Fixes:4ce247af3f
("usb: gadget: rndis: add spinlock for rndis response list") Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I7c4d32524b7b10f23a15be35f762b1ed9f345b95
This commit is contained in:
@@ -63,6 +63,8 @@ MODULE_PARM_DESC (rndis_debug, "enable debugging");
|
|||||||
|
|
||||||
static DEFINE_IDA(rndis_ida);
|
static DEFINE_IDA(rndis_ida);
|
||||||
|
|
||||||
|
static DEFINE_SPINLOCK(resp_lock);
|
||||||
|
|
||||||
/* Driver Version */
|
/* Driver Version */
|
||||||
static const __le32 rndis_driver_version = cpu_to_le32(1);
|
static const __le32 rndis_driver_version = cpu_to_le32(1);
|
||||||
|
|
||||||
@@ -922,7 +924,6 @@ struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v)
|
|||||||
params->resp_avail = resp_avail;
|
params->resp_avail = resp_avail;
|
||||||
params->v = v;
|
params->v = v;
|
||||||
INIT_LIST_HEAD(¶ms->resp_queue);
|
INIT_LIST_HEAD(¶ms->resp_queue);
|
||||||
spin_lock_init(¶ms->resp_lock);
|
|
||||||
pr_debug("%s: configNr = %d\n", __func__, i);
|
pr_debug("%s: configNr = %d\n", __func__, i);
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
@@ -1016,14 +1017,14 @@ void rndis_free_response(struct rndis_params *params, u8 *buf)
|
|||||||
{
|
{
|
||||||
rndis_resp_t *r, *n;
|
rndis_resp_t *r, *n;
|
||||||
|
|
||||||
spin_lock(¶ms->resp_lock);
|
spin_lock(&resp_lock);
|
||||||
list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) {
|
list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) {
|
||||||
if (r->buf == buf) {
|
if (r->buf == buf) {
|
||||||
list_del(&r->list);
|
list_del(&r->list);
|
||||||
kfree(r);
|
kfree(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spin_unlock(¶ms->resp_lock);
|
spin_unlock(&resp_lock);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rndis_free_response);
|
EXPORT_SYMBOL_GPL(rndis_free_response);
|
||||||
|
|
||||||
@@ -1033,17 +1034,17 @@ u8 *rndis_get_next_response(struct rndis_params *params, u32 *length)
|
|||||||
|
|
||||||
if (!length) return NULL;
|
if (!length) return NULL;
|
||||||
|
|
||||||
spin_lock(¶ms->resp_lock);
|
spin_lock(&resp_lock);
|
||||||
list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) {
|
list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) {
|
||||||
if (!r->send) {
|
if (!r->send) {
|
||||||
r->send = 1;
|
r->send = 1;
|
||||||
*length = r->length;
|
*length = r->length;
|
||||||
spin_unlock(¶ms->resp_lock);
|
spin_unlock(&resp_lock);
|
||||||
return r->buf;
|
return r->buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock(¶ms->resp_lock);
|
spin_unlock(&resp_lock);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rndis_get_next_response);
|
EXPORT_SYMBOL_GPL(rndis_get_next_response);
|
||||||
@@ -1060,9 +1061,9 @@ static rndis_resp_t *rndis_add_response(struct rndis_params *params, u32 length)
|
|||||||
r->length = length;
|
r->length = length;
|
||||||
r->send = 0;
|
r->send = 0;
|
||||||
|
|
||||||
spin_lock(¶ms->resp_lock);
|
spin_lock(&resp_lock);
|
||||||
list_add_tail(&r->list, ¶ms->resp_queue);
|
list_add_tail(&r->list, ¶ms->resp_queue);
|
||||||
spin_unlock(¶ms->resp_lock);
|
spin_unlock(&resp_lock);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -174,7 +174,6 @@ typedef struct rndis_params {
|
|||||||
void (*resp_avail)(void *v);
|
void (*resp_avail)(void *v);
|
||||||
void *v;
|
void *v;
|
||||||
struct list_head resp_queue;
|
struct list_head resp_queue;
|
||||||
spinlock_t resp_lock;
|
|
||||||
} rndis_params;
|
} rndis_params;
|
||||||
|
|
||||||
/* RNDIS Message parser and other useless functions */
|
/* RNDIS Message parser and other useless functions */
|
||||||
|
Reference in New Issue
Block a user