Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dca2f8ee authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net/packet: fix overflow in check for tp_reserve"

parents 5b49d83d 9ef4691f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3314,6 +3314,8 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
			return -EBUSY;
		if (copy_from_user(&val, optval, sizeof(val)))
			return -EFAULT;
		if (val > INT_MAX)
			return -EINVAL;
		po->tp_reserve = val;
		return 0;
	}
@@ -3819,6 +3821,8 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
		rb->frames_per_block = req->tp_block_size/req->tp_frame_size;
		if (unlikely(rb->frames_per_block <= 0))
			goto out;
		if (unlikely(req->tp_block_size > UINT_MAX / req->tp_block_nr))
			goto out;
		if (unlikely((rb->frames_per_block * req->tp_block_nr) !=
					req->tp_frame_nr))
			goto out;