[PATCH] net/atm/mpc: Fix dereference NULL pointer in mpc_send_packet()

Li Qiong
2023-02-23T06:55:43Z

The 'non_ip' statement need do 'mpc' pointer dereference,
so return '-ENODEV' if 'mpc' is NULL.

Signed-off-by: Li Qiong <liqiong@nfschina.com>
---
net/atm/mpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 033871e718a3..1cd6610b8a12 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -577,7 +577,7 @@ static netdev_tx_t mpc_send_packet(struct sk_buff *skb,
mpc = find_mpc_by_lec(dev); /* this should NEVER fail */
if (mpc == NULL) {
pr_info("(%s) no MPC found\n", dev->name);
- goto non_ip;
+ return -ENODEV;
}

eth = (struct ethhdr *)skb->data;
--
2.11.0