Skip to content

Commit daece95

Browse files
atm: Fix Use-After-Free in do_vcc_ioctl
jira VULN-473 cve CVE-2023-51780 commit-author Hyunwoo Kim <[email protected]> commit 24e90b9 Because do_vcc_ioctl() accesses sk->sk_receive_queue without holding a sk->sk_receive_queue.lock, it can cause a race with vcc_recvmsg(). A use-after-free for skb occurs with the following flow. ``` do_vcc_ioctl() -> skb_peek() vcc_recvmsg() -> skb_recv_datagram() -> skb_free_datagram() ``` Add sk->sk_receive_queue.lock to do_vcc_ioctl() to fix this issue. Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Hyunwoo Kim <[email protected]> Link: https://lore.kernel.org/r/20231209094210.GA403126@v4bel-B760M-AORUS-ELITE-AX Signed-off-by: Paolo Abeni <[email protected]> (cherry picked from commit 24e90b9) Signed-off-by: Pratham Patel <[email protected]>
1 parent 23e807d commit daece95

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

net/atm/ioctl.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,17 @@ static int do_vcc_ioctl(struct socket *sock, unsigned int cmd,
7171
case SIOCINQ:
7272
{
7373
struct sk_buff *skb;
74+
int amount;
7475

7576
if (sock->state != SS_CONNECTED) {
7677
error = -EINVAL;
7778
goto done;
7879
}
80+
spin_lock_irq(&sk->sk_receive_queue.lock);
7981
skb = skb_peek(&sk->sk_receive_queue);
80-
error = put_user(skb ? skb->len : 0,
81-
(int __user *)argp) ? -EFAULT : 0;
82+
amount = skb ? skb->len : 0;
83+
spin_unlock_irq(&sk->sk_receive_queue.lock);
84+
error = put_user(amount, (int __user *)argp) ? -EFAULT : 0;
8285
goto done;
8386
}
8487
case SIOCGSTAMP: /* borrowed from IP */

0 commit comments

Comments
 (0)