* [PATCH net] ethtool: strset: Fix reply_size value
@ 2021-06-17 15:42 Amit Cohen
2021-06-17 16:29 ` Ido Schimmel
2021-06-17 16:29 ` Michal Kubecek
0 siblings, 2 replies; 5+ messages in thread
From: Amit Cohen @ 2021-06-17 15:42 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, mkubecek, idosch, Amit Cohen, Jiri Pirko
strset_reply_size() does not take into account the size required for the
'ETHTOOL_A_STRSET_STRINGSETS' nested attribute.
Since commit 4d1fb7cde0cc ("ethtool: add a stricter length check") this
results in the following warning in the kernel log:
ethnl cmd 1: calculated reply length 2236, but consumed 2240
WARNING: CPU: 2 PID: 30549 at net/ethtool/netlink.c:360 ethnl_default_doit+0x29f/0x310
Add the appropriate size to the calculation.
Fixes: 71921690f974 ("ethtool: provide string sets with STRSET_GET request")
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
---
net/ethtool/strset.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ethtool/strset.c b/net/ethtool/strset.c
index b3029fff715d..86dcb6b099b3 100644
--- a/net/ethtool/strset.c
+++ b/net/ethtool/strset.c
@@ -365,7 +365,7 @@ static int strset_reply_size(const struct ethnl_req_info *req_base,
len += ret;
}
- return len;
+ return nla_total_size(len);
}
/* fill one string into reply */
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] ethtool: strset: Fix reply_size value
2021-06-17 15:42 [PATCH net] ethtool: strset: Fix reply_size value Amit Cohen
@ 2021-06-17 16:29 ` Ido Schimmel
2021-06-17 16:29 ` Michal Kubecek
1 sibling, 0 replies; 5+ messages in thread
From: Ido Schimmel @ 2021-06-17 16:29 UTC (permalink / raw)
To: Amit Cohen; +Cc: netdev, davem, kuba, mkubecek, idosch, Jiri Pirko
On Thu, Jun 17, 2021 at 06:42:52PM +0300, Amit Cohen wrote:
> strset_reply_size() does not take into account the size required for the
> 'ETHTOOL_A_STRSET_STRINGSETS' nested attribute.
> Since commit 4d1fb7cde0cc ("ethtool: add a stricter length check") this
> results in the following warning in the kernel log:
>
> ethnl cmd 1: calculated reply length 2236, but consumed 2240
> WARNING: CPU: 2 PID: 30549 at net/ethtool/netlink.c:360 ethnl_default_doit+0x29f/0x310
>
> Add the appropriate size to the calculation.
>
> Fixes: 71921690f974 ("ethtool: provide string sets with STRSET_GET request")
> Signed-off-by: Amit Cohen <amcohen@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Ido Schimmel <idosch@nvidia.com>
> Tested-by: Ido Schimmel <idosch@nvidia.com>
Ha, seems this is addressed by commit e175aef90269 ("ethtool: strset:
fix message length calculation") in net.git which actually motivated
commit 4d1fb7cde0cc ("ethtool: add a stricter length check").
The former is still not in net-next.git, which is why the warning is
triggered there.
The patch can be dropped.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] ethtool: strset: Fix reply_size value
2021-06-17 15:42 [PATCH net] ethtool: strset: Fix reply_size value Amit Cohen
2021-06-17 16:29 ` Ido Schimmel
@ 2021-06-17 16:29 ` Michal Kubecek
2021-06-17 16:33 ` Ido Schimmel
1 sibling, 1 reply; 5+ messages in thread
From: Michal Kubecek @ 2021-06-17 16:29 UTC (permalink / raw)
To: Amit Cohen; +Cc: netdev, davem, kuba, idosch, Jiri Pirko
On Thu, Jun 17, 2021 at 06:42:52PM +0300, Amit Cohen wrote:
> strset_reply_size() does not take into account the size required for the
> 'ETHTOOL_A_STRSET_STRINGSETS' nested attribute.
> Since commit 4d1fb7cde0cc ("ethtool: add a stricter length check") this
> results in the following warning in the kernel log:
>
> ethnl cmd 1: calculated reply length 2236, but consumed 2240
> WARNING: CPU: 2 PID: 30549 at net/ethtool/netlink.c:360 ethnl_default_doit+0x29f/0x310
>
> Add the appropriate size to the calculation.
>
> Fixes: 71921690f974 ("ethtool: provide string sets with STRSET_GET request")
> Signed-off-by: Amit Cohen <amcohen@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Ido Schimmel <idosch@nvidia.com>
> Tested-by: Ido Schimmel <idosch@nvidia.com>
> ---
> net/ethtool/strset.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ethtool/strset.c b/net/ethtool/strset.c
> index b3029fff715d..86dcb6b099b3 100644
> --- a/net/ethtool/strset.c
> +++ b/net/ethtool/strset.c
> @@ -365,7 +365,7 @@ static int strset_reply_size(const struct ethnl_req_info *req_base,
> len += ret;
> }
>
> - return len;
> + return nla_total_size(len);
> }
>
> /* fill one string into reply */
I believe this issue has been already fixed in net tree by commit
e175aef90269 ("ethtool: strset: fix message length calculation") but as
this commit has not been merged into net-next yet, you could hit it with
the stricter check.
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] ethtool: strset: Fix reply_size value
2021-06-17 16:29 ` Michal Kubecek
@ 2021-06-17 16:33 ` Ido Schimmel
2021-06-17 21:07 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Ido Schimmel @ 2021-06-17 16:33 UTC (permalink / raw)
To: Michal Kubecek; +Cc: Amit Cohen, netdev, davem, kuba, idosch, Jiri Pirko
On Thu, Jun 17, 2021 at 06:29:23PM +0200, Michal Kubecek wrote:
> I believe this issue has been already fixed in net tree by commit
> e175aef90269 ("ethtool: strset: fix message length calculation") but as
> this commit has not been merged into net-next yet, you could hit it with
> the stricter check.
Yea. I reached the same conclusion :/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] ethtool: strset: Fix reply_size value
2021-06-17 16:33 ` Ido Schimmel
@ 2021-06-17 21:07 ` Jakub Kicinski
0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2021-06-17 21:07 UTC (permalink / raw)
To: Ido Schimmel
Cc: Michal Kubecek, Amit Cohen, netdev, davem, idosch, Jiri Pirko
On Thu, 17 Jun 2021 19:33:27 +0300 Ido Schimmel wrote:
> On Thu, Jun 17, 2021 at 06:29:23PM +0200, Michal Kubecek wrote:
> > I believe this issue has been already fixed in net tree by commit
> > e175aef90269 ("ethtool: strset: fix message length calculation") but as
> > this commit has not been merged into net-next yet, you could hit it with
> > the stricter check.
>
> Yea. I reached the same conclusion :/
Ah damn, I should have waited for the merge, sorry about that :S
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-06-17 21:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 15:42 [PATCH net] ethtool: strset: Fix reply_size value Amit Cohen
2021-06-17 16:29 ` Ido Schimmel
2021-06-17 16:29 ` Michal Kubecek
2021-06-17 16:33 ` Ido Schimmel
2021-06-17 21:07 ` Jakub Kicinski
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.