* [PATCH net] net: qualcomm: rmnet: Allow configuration updates to existing devices
@ 2020-03-31 22:43 Subash Abhinov Kasiviswanathan
2020-04-01 0:06 ` Alex Elder
2020-04-02 13:50 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Subash Abhinov Kasiviswanathan @ 2020-03-31 22:43 UTC (permalink / raw)
To: ap420073, davem, netdev
Cc: Subash Abhinov Kasiviswanathan, Alex Elder, Sean Tranchetti
This allows the changelink operation to succeed if the mux_id was
specified as an argument. Note that the mux_id must match the
existing mux_id of the rmnet device or should be an unused mux_id.
Fixes: 1dc49e9d164c ("net: rmnet: do not allow to change mux id if mux id is duplicated")
Reported-by: Alex Elder <elder@linaro.org>
Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
---
.../ethernet/qualcomm/rmnet/rmnet_config.c | 21 ++++++++++++-------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
index fbf4cbcf1a65..06332984399d 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
@@ -294,19 +294,24 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
if (data[IFLA_RMNET_MUX_ID]) {
mux_id = nla_get_u16(data[IFLA_RMNET_MUX_ID]);
- if (rmnet_get_endpoint(port, mux_id)) {
- NL_SET_ERR_MSG_MOD(extack, "MUX ID already exists");
- return -EINVAL;
- }
ep = rmnet_get_endpoint(port, priv->mux_id);
if (!ep)
return -ENODEV;
- hlist_del_init_rcu(&ep->hlnode);
- hlist_add_head_rcu(&ep->hlnode, &port->muxed_ep[mux_id]);
+ if (mux_id != priv->mux_id) {
+ if (rmnet_get_endpoint(port, mux_id)) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "MUX ID already exists");
+ return -EINVAL;
+ }
- ep->mux_id = mux_id;
- priv->mux_id = mux_id;
+ hlist_del_init_rcu(&ep->hlnode);
+ hlist_add_head_rcu(&ep->hlnode,
+ &port->muxed_ep[mux_id]);
+
+ ep->mux_id = mux_id;
+ priv->mux_id = mux_id;
+ }
}
if (data[IFLA_RMNET_FLAGS]) {
--
2.26.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: qualcomm: rmnet: Allow configuration updates to existing devices
2020-03-31 22:43 [PATCH net] net: qualcomm: rmnet: Allow configuration updates to existing devices Subash Abhinov Kasiviswanathan
@ 2020-04-01 0:06 ` Alex Elder
2020-04-01 21:44 ` subashab
2020-04-02 13:50 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Alex Elder @ 2020-04-01 0:06 UTC (permalink / raw)
To: Subash Abhinov Kasiviswanathan, ap420073, davem, netdev; +Cc: Sean Tranchetti
On 3/31/20 5:43 PM, Subash Abhinov Kasiviswanathan wrote:
> This allows the changelink operation to succeed if the mux_id was
> specified as an argument. Note that the mux_id must match the
> existing mux_id of the rmnet device or should be an unused mux_id.
>
> Fixes: 1dc49e9d164c ("net: rmnet: do not allow to change mux id if mux id is duplicated")
> Reported-by: Alex Elder <elder@linaro.org>
> Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
> Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
This was a regression in 5.6, and got back-ported to 5.5.11 and
possibly further back. Please be sure the fix gets applied to
stable branches if appropriate.
If you happen to post a second version of this I have a suggestion,
below. But the patch looks OK to me as-is.
Thanks.
Tested-by: Alex Elder <elder@linaro.org>
> ---
> .../ethernet/qualcomm/rmnet/rmnet_config.c | 21 ++++++++++++-------
> 1 file changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> index fbf4cbcf1a65..06332984399d 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> @@ -294,19 +294,24 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
>
> if (data[IFLA_RMNET_MUX_ID]) {
> mux_id = nla_get_u16(data[IFLA_RMNET_MUX_ID]);
> - if (rmnet_get_endpoint(port, mux_id)) {
> - NL_SET_ERR_MSG_MOD(extack, "MUX ID already exists");
> - return -EINVAL;
> - }
My suggestion is this: Since the endpoint pointer isn't used
outside the "if (mux_id != priv->mux_id)" block, you could
do the lookup inside that block.
> ep = rmnet_get_endpoint(port, priv->mux_id);
> if (!ep)
> return -ENODEV;
>
> - hlist_del_init_rcu(&ep->hlnode);
> - hlist_add_head_rcu(&ep->hlnode, &port->muxed_ep[mux_id]);
> + if (mux_id != priv->mux_id) {
> + if (rmnet_get_endpoint(port, mux_id)) {
> + NL_SET_ERR_MSG_MOD(extack,
> + "MUX ID already exists");
> + return -EINVAL;
> + }
>
> - ep->mux_id = mux_id;
> - priv->mux_id = mux_id;
> + hlist_del_init_rcu(&ep->hlnode);
> + hlist_add_head_rcu(&ep->hlnode,
> + &port->muxed_ep[mux_id]);
> +
> + ep->mux_id = mux_id;
> + priv->mux_id = mux_id;
> + }
> }
>
> if (data[IFLA_RMNET_FLAGS]) {
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: qualcomm: rmnet: Allow configuration updates to existing devices
2020-04-01 0:06 ` Alex Elder
@ 2020-04-01 21:44 ` subashab
0 siblings, 0 replies; 4+ messages in thread
From: subashab @ 2020-04-01 21:44 UTC (permalink / raw)
To: Alex Elder; +Cc: ap420073, davem, netdev, Sean Tranchetti
On 2020-03-31 18:06, Alex Elder wrote:
> On 3/31/20 5:43 PM, Subash Abhinov Kasiviswanathan wrote:
>> This allows the changelink operation to succeed if the mux_id was
>> specified as an argument. Note that the mux_id must match the
>> existing mux_id of the rmnet device or should be an unused mux_id.
>>
>> Fixes: 1dc49e9d164c ("net: rmnet: do not allow to change mux id if mux
>> id is duplicated")
>> Reported-by: Alex Elder <elder@linaro.org>
>> Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
>> Signed-off-by: Subash Abhinov Kasiviswanathan
>> <subashab@codeaurora.org>
>
> This was a regression in 5.6, and got back-ported to 5.5.11 and
> possibly further back. Please be sure the fix gets applied to
> stable branches if appropriate.
>
> If you happen to post a second version of this I have a suggestion,
> below. But the patch looks OK to me as-is.
>
> Thanks.
>
> Tested-by: Alex Elder <elder@linaro.org>
>
>> ---
>> .../ethernet/qualcomm/rmnet/rmnet_config.c | 21
>> ++++++++++++-------
>> 1 file changed, 13 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
>> b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
>> index fbf4cbcf1a65..06332984399d 100644
>> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
>> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
>> @@ -294,19 +294,24 @@ static int rmnet_changelink(struct net_device
>> *dev, struct nlattr *tb[],
>>
>> if (data[IFLA_RMNET_MUX_ID]) {
>> mux_id = nla_get_u16(data[IFLA_RMNET_MUX_ID]);
>> - if (rmnet_get_endpoint(port, mux_id)) {
>> - NL_SET_ERR_MSG_MOD(extack, "MUX ID already exists");
>> - return -EINVAL;
>> - }
>
> My suggestion is this: Since the endpoint pointer isn't used
> outside the "if (mux_id != priv->mux_id)" block, you could
> do the lookup inside that block.
I've sent a v2 now based on your comment.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: qualcomm: rmnet: Allow configuration updates to existing devices
2020-03-31 22:43 [PATCH net] net: qualcomm: rmnet: Allow configuration updates to existing devices Subash Abhinov Kasiviswanathan
2020-04-01 0:06 ` Alex Elder
@ 2020-04-02 13:50 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2020-04-02 13:50 UTC (permalink / raw)
To: subashab; +Cc: ap420073, netdev, elder, stranche
From: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Date: Tue, 31 Mar 2020 16:43:48 -0600
> This allows the changelink operation to succeed if the mux_id was
> specified as an argument. Note that the mux_id must match the
> existing mux_id of the rmnet device or should be an unused mux_id.
>
> Fixes: 1dc49e9d164c ("net: rmnet: do not allow to change mux id if mux id is duplicated")
> Reported-by: Alex Elder <elder@linaro.org>
> Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
> Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-02 13:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31 22:43 [PATCH net] net: qualcomm: rmnet: Allow configuration updates to existing devices Subash Abhinov Kasiviswanathan
2020-04-01 0:06 ` Alex Elder
2020-04-01 21:44 ` subashab
2020-04-02 13:50 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.