Skip to content

Commit aa81700

Browse files
dcarattidavem330
authored andcommitted
macsec: fix NULL dereference in macsec_upd_offload()
macsec_upd_offload() gets the value of MACSEC_OFFLOAD_ATTR_TYPE without checking its presence in the request message, and this causes a NULL dereference. Fix it rejecting any configuration that does not include this attribute. Reported-and-tested-by: [email protected] Fixes: dcb780f ("net: macsec: add nla support for changing the offloading selection") Signed-off-by: Davide Caratti <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent db1f00f commit aa81700

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/macsec.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,6 +2594,9 @@ static int macsec_upd_offload(struct sk_buff *skb, struct genl_info *info)
25942594
return PTR_ERR(dev);
25952595
macsec = macsec_priv(dev);
25962596

2597+
if (!tb_offload[MACSEC_OFFLOAD_ATTR_TYPE])
2598+
return -EINVAL;
2599+
25972600
offload = nla_get_u8(tb_offload[MACSEC_OFFLOAD_ATTR_TYPE]);
25982601
if (macsec->offload == offload)
25992602
return 0;

0 commit comments

Comments
 (0)