Skip to content

Commit 5fc11a4

Browse files
Gavrilov Iliakuba-moo
authored andcommitted
net: devlink: Add missing error check to devlink_resource_put()
When the resource size changes, the return value of the 'nla_put_u64_64bit' function is not checked. That has been fixed to avoid rechecking at the next step. Found by InfoTeCS on behalf of Linux Verification Center (linuxtesting.org) with SVACE. Note that this is harmless, we'd error out at the next put(). Signed-off-by: Ilia.Gavrilov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ce098da commit 5fc11a4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

net/core/devlink.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4441,9 +4441,10 @@ static int devlink_resource_put(struct devlink *devlink, struct sk_buff *skb,
44414441
nla_put_u64_64bit(skb, DEVLINK_ATTR_RESOURCE_ID, resource->id,
44424442
DEVLINK_ATTR_PAD))
44434443
goto nla_put_failure;
4444-
if (resource->size != resource->size_new)
4445-
nla_put_u64_64bit(skb, DEVLINK_ATTR_RESOURCE_SIZE_NEW,
4446-
resource->size_new, DEVLINK_ATTR_PAD);
4444+
if (resource->size != resource->size_new &&
4445+
nla_put_u64_64bit(skb, DEVLINK_ATTR_RESOURCE_SIZE_NEW,
4446+
resource->size_new, DEVLINK_ATTR_PAD))
4447+
goto nla_put_failure;
44474448
if (devlink_resource_occ_put(resource, skb))
44484449
goto nla_put_failure;
44494450
if (devlink_resource_size_params_put(resource, skb))

0 commit comments

Comments
 (0)