Skip to content

Commit 6f0d325

Browse files
Wei Yongjundavem330
authored andcommitted
net: dsa: sja1105: fix error return code in sja1105_cls_flower_add()
The return value 'rc' maybe overwrite to 0 in the flow_action_for_each loop, the error code from the offload not support error handling will not set. This commit fix it to return -EOPNOTSUPP. Fixes: 6a56e19 ("flow_offload: reject configuration of packet-per-second policing in offload drivers") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6d16ead commit 6f0d325

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎drivers/net/dsa/sja1105/sja1105_flower.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,13 @@ int sja1105_cls_flower_add(struct dsa_switch *ds, int port,
317317
if (rc)
318318
return rc;
319319

320-
rc = -EOPNOTSUPP;
321-
322320
flow_action_for_each(i, act, &rule->action) {
323321
switch (act->id) {
324322
case FLOW_ACTION_POLICE:
325323
if (act->police.rate_pkt_ps) {
326324
NL_SET_ERR_MSG_MOD(extack,
327325
"QoS offload not support packets per second");
326+
rc = -EOPNOTSUPP;
328327
goto out;
329328
}
330329

0 commit comments

Comments
 (0)