rpmsg fixes for v4.14

This corrects two mistakes in the Qualcomm GLINK SMEM driver.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJZ3ltDAAoJEAsfOT8Nma3F/BIP/1IwopdNG2ABOsGhydSemz58
 3g6ED5/X+h6ufmFqyhP7EJ6PIqag0lv3b6+XYeFrXoXx9PlCAtp9kk6jVFjMR8+/
 DDDrD3zUDbHpDU4HH8q1j3AnvUj8gjmB3sBoPSAG0zdqCSLzEsn/MRfd45G/Be7N
 zV/J5MQzXAubvlQpsqsVbRoXQPdo8NQIE2WTRAne0voUiJce7NbcTS6m8OdXoh1Q
 W0PLq9fyU6YxwOkR1LdW8mU1b430nYE49FdBn4glYw9kRPJxT/PRIUXApIr6Fo1V
 zV/+nBAoP+ZrFdre6NT8CBzOdhbuVNbHEdIjQQEIHxsOLWwCk2XBZHLbKFgCVXi3
 IKqGDnfrz4nAKotq3illXzZacav+78pZCkObsfMyRnj9P/O5ZuC9GwUNJNFWz61B
 n4ZGJHeXOOWSxI0yNY4W/T9q+gpzAanCt+iETc3rQ+oBDHMUC8GRuaFGzV+nDkyG
 pK/nhdx3Zz5ev/hsRX33R21HNlfuAJZo0XU6gvy7TrNpiJbgTePoA7FzndpBJWm4
 nilDIzhPML+MtqcyBcFkj3Z4/OjyQELeVq9cnfp1PqeLUv+b/NzE6BVw2bGsxrWK
 iibr9sbumvMVjNZohSsYFVJAudSNQzuIt8cF/KldHcSpt4A3sHAw+QKGGAQYkIf6
 /kKJBNuF9Yb5gMJAEJ4Z
 =W1P1
 -----END PGP SIGNATURE-----

Merge tag 'rpmsg-v4.14-fixes' of git://github.com/andersson/remoteproc

Pull rpmsg fixes from Bjorn Andersson:
 "This corrects two mistakes in the Qualcomm GLINK SMEM driver"

* tag 'rpmsg-v4.14-fixes' of git://github.com/andersson/remoteproc:
  rpmsg: glink: Fix memory leak in qcom_glink_alloc_intent()
  rpmsg: glink: Unlock on error in qcom_glink_request_intent()
This commit is contained in:
Linus Torvalds 2017-10-11 12:01:38 -07:00
commit ff5abbe799

View file

@ -635,19 +635,18 @@ qcom_glink_alloc_intent(struct qcom_glink *glink,
unsigned long flags;
intent = kzalloc(sizeof(*intent), GFP_KERNEL);
if (!intent)
return NULL;
intent->data = kzalloc(size, GFP_KERNEL);
if (!intent->data)
return NULL;
goto free_intent;
spin_lock_irqsave(&channel->intent_lock, flags);
ret = idr_alloc_cyclic(&channel->liids, intent, 1, -1, GFP_ATOMIC);
if (ret < 0) {
spin_unlock_irqrestore(&channel->intent_lock, flags);
return NULL;
goto free_data;
}
spin_unlock_irqrestore(&channel->intent_lock, flags);
@ -656,6 +655,12 @@ qcom_glink_alloc_intent(struct qcom_glink *glink,
intent->reuse = reuseable;
return intent;
free_data:
kfree(intent->data);
free_intent:
kfree(intent);
return NULL;
}
static void qcom_glink_handle_rx_done(struct qcom_glink *glink,
@ -1197,7 +1202,7 @@ static int qcom_glink_request_intent(struct qcom_glink *glink,
ret = qcom_glink_tx(glink, &cmd, sizeof(cmd), NULL, 0, true);
if (ret)
return ret;
goto unlock;
ret = wait_for_completion_timeout(&channel->intent_req_comp, 10 * HZ);
if (!ret) {
@ -1207,6 +1212,7 @@ static int qcom_glink_request_intent(struct qcom_glink *glink,
ret = channel->intent_req_result ? 0 : -ECANCELED;
}
unlock:
mutex_unlock(&channel->intent_req_lock);
return ret;
}