Skip to content

Commit ee614c8

Browse files
jahurleydavem330
authored andcommitted
nfp: flower: fix port metadata conversion bug
Function nfp_flower_repr_get_type_and_port expects an enum nfp_repr_type return value but, if the repr type is unknown, returns a value of type enum nfp_flower_cmsg_port_type. This means that if FW encodes the port ID in a way the driver does not understand instead of dropping the frame driver may attribute it to a physical port (uplink) provided the port number is less than physical port count. Fix this and ensure a net_device of NULL is returned if the repr can not be determined. Fixes: 1025351 ("nfp: add flower app") Signed-off-by: John Hurley <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d0fdb36 commit ee614c8

File tree

1 file changed

+3
-1
lines changed
  • drivers/net/ethernet/netronome/nfp/flower

1 file changed

+3
-1
lines changed

drivers/net/ethernet/netronome/nfp/flower/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ nfp_flower_repr_get_type_and_port(struct nfp_app *app, u32 port_id, u8 *port)
8080
return NFP_REPR_TYPE_VF;
8181
}
8282

83-
return NFP_FLOWER_CMSG_PORT_TYPE_UNSPEC;
83+
return __NFP_REPR_TYPE_MAX;
8484
}
8585

8686
static struct net_device *
@@ -91,6 +91,8 @@ nfp_flower_repr_get(struct nfp_app *app, u32 port_id)
9191
u8 port = 0;
9292

9393
repr_type = nfp_flower_repr_get_type_and_port(app, port_id, &port);
94+
if (repr_type > NFP_REPR_TYPE_MAX)
95+
return NULL;
9496

9597
reprs = rcu_dereference(app->reprs[repr_type]);
9698
if (!reprs)

0 commit comments

Comments
 (0)