From: Yang Li Date: Fri, 5 Nov 2021 07:12:50 +0000 (+0800) Subject: amt: Fix NULL but dereferenced coccicheck error X-Git-Tag: v5.16-rc1~50^2~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3f81c579912855f19ed1a72af8133485a6119fba;p=thirdparty%2Fkernel%2Flinux.git amt: Fix NULL but dereferenced coccicheck error Eliminate the following coccicheck warning: ./drivers/net/amt.c:2795:6-9: ERROR: amt is NULL but dereferenced. Reported-by: Abaci Robot Signed-off-by: Yang Li Signed-off-by: David S. Miller --- diff --git a/drivers/net/amt.c b/drivers/net/amt.c index 896c9e2857f07..cfd6c8cb4e972 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -2766,7 +2766,7 @@ static int amt_err_lookup(struct sock *sk, struct sk_buff *skb) rcu_read_lock_bh(); amt = rcu_dereference_sk_user_data(sk); if (!amt) - goto drop; + goto out; if (amt->mode != AMT_MODE_GATEWAY) goto drop; @@ -2788,6 +2788,7 @@ static int amt_err_lookup(struct sock *sk, struct sk_buff *skb) default: goto drop; } +out: rcu_read_unlock_bh(); return 0; drop: