Skip to content

Commit 95a234f

Browse files
Haoxiang Likuba-moo
authored andcommitted
net: ethernet: rtsn: Fix a null pointer dereference in rtsn_probe()
Add check for the return value of rcar_gen4_ptp_alloc() to prevent potential null pointer dereference. Fixes: b0d3969 ("net: ethernet: rtsn: Add support for Renesas Ethernet-TSN") Cc: [email protected] Signed-off-by: Haoxiang Li <[email protected]> Reviewed-by: Niklas Söderlund <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 462da82 commit 95a234f

File tree

1 file changed

+5
-0
lines changed
  • drivers/net/ethernet/renesas

1 file changed

+5
-0
lines changed

drivers/net/ethernet/renesas/rtsn.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,12 @@ static int rtsn_probe(struct platform_device *pdev)
12591259
priv = netdev_priv(ndev);
12601260
priv->pdev = pdev;
12611261
priv->ndev = ndev;
1262+
12621263
priv->ptp_priv = rcar_gen4_ptp_alloc(pdev);
1264+
if (!priv->ptp_priv) {
1265+
ret = -ENOMEM;
1266+
goto error_free;
1267+
}
12631268

12641269
spin_lock_init(&priv->lock);
12651270
platform_set_drvdata(pdev, priv);

0 commit comments

Comments
 (0)