mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
net/af_iucv: fix NULL deref in afiucv_hs_callback_syn()
commit47a5116e56upstream. afiucv_hs_callback_syn() allocates the child socket with GFP_ATOMIC. If the allocation fails, nsk is NULL. The connection-refused path is entered when the listen state check fails, the accept backlog is full, or nsk is NULL. The code unconditionally calls iucv_sock_kill(nsk) in that path. iucv_sock_kill() does not accept a NULL socket pointer and immediately dereferences sk via sock_flag(sk, SOCK_ZAPPED). When nsk is NULL, calling iucv_sock_kill(nsk) results in a NULL pointer dereference. Only call iucv_sock_kill() when a child socket was successfully allocated. Fixes:3881ac441f("af_iucv: add HiperSockets transport") Cc: stable@vger.kernel.org Reviewed-by: Alexandra Winter <wintera@linux.ibm.com> Signed-off-by: Hidayath Khan <hidayath@linux.ibm.com> Link: https://patch.msgid.link/20260709191732.124092-1-hidayath@linux.ibm.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2abdacc927
commit
8bb111f87d
+2
-1
@@ -1873,7 +1873,8 @@ static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb)
|
||||
afiucv_swap_src_dest(skb);
|
||||
trans_hdr->flags = AF_IUCV_FLAG_SYN | AF_IUCV_FLAG_FIN;
|
||||
err = dev_queue_xmit(skb);
|
||||
iucv_sock_kill(nsk);
|
||||
if (nsk)
|
||||
iucv_sock_kill(nsk);
|
||||
bh_unlock_sock(sk);
|
||||
goto out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user