Just using 'rem > 0' might be unsafe, so it's better
to use the nla_ok() instead.
Because we can see from the nla_next() that
'*remaining' might be smaller than 'totlen'. And nla_ok()
will avoid it happening.
Signed-off-by: Jiasheng Jiang <redacted>
---
net/openvswitch/actions.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-09-16 14:36:43
On Thu, 16 Sep 2021 01:43:23 +0000 Jiasheng Jiang wrote:
Just using 'rem > 0' might be unsafe, so it's better
to use the nla_ok() instead.
Because we can see from the nla_next() that
'*remaining' might be smaller than 'totlen'. And nla_ok()
will avoid it happening.
Signed-off-by: Jiasheng Jiang <redacted>
Are the attributes coming from the user space here or are generated
by the kernel / were already validated? Depending on that this is
either a fix and needs to be backported or a possible cleanup.
Please repost with the explanation where attrs come from in the commit
message, and if it's indeed a bug please add a Fixes tag.
If we do need the nla_ok() we should probably also switch to
nla_for_each_attr() and nla_for_each_nested().
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-09-16 14:38:56
On Thu, 16 Sep 2021 07:36:40 -0700 Jakub Kicinski wrote:
On Thu, 16 Sep 2021 01:43:23 +0000 Jiasheng Jiang wrote:
quoted
Just using 'rem > 0' might be unsafe, so it's better
to use the nla_ok() instead.
Because we can see from the nla_next() that
'*remaining' might be smaller than 'totlen'. And nla_ok()
will avoid it happening.
Signed-off-by: Jiasheng Jiang <redacted>
Are the attributes coming from the user space here or are generated
by the kernel / were already validated? Depending on that this is
either a fix and needs to be backported or a possible cleanup.
Please repost with the explanation where attrs come from in the commit
message, and if it's indeed a bug please add a Fixes tag.
And please use different subject for each patch, otherwise patchwork
bot thinks this is just two versions of the same patch and marks the
one posted earlier as Superseded.
If we do need the nla_ok() we should probably also switch to
nla_for_each_attr() and nla_for_each_nested().