From nobody Sat Apr 08 19:45:00 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pv5L44zv6z44nbJ; Sat, 8 Apr 2023 19:45:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pv5L42rVqz44Hj; Sat, 8 Apr 2023 19:45:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680983100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZUp5fr+XU4qC6WEjdRF6ZQ5aZDG2ra/5otDx2LFjshc=; b=IEPDy5uF+2aZg1JNMkIagMHufjQF0J5SSO67sf4kolL9hZJk3orWM3njdKsu6RdE4le8sR d+Nr6B8oHWnomiXluqYx0KTjbCssvBpc5fqDT/0RjdLPZrqK3n/Kdj019r6nfACN61hhHS QsZ7nC2adCTa5dEozo6eurhldZsQ8CMJdZbF2PonAeCzDnQVlH1+F/qz9Ta276eDbui6Gd Leu1foX6XHgqmSHymnhcXusYcObTF0TsNiV+l/nTB5thx/kgsFhJPo8930Dlx/4qzuCjXP rjs3ZiDTcMY95ztgbErSOHf35UHlzTgr87RBsB7ohGqn2SQmglwYRLJG3HO2Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680983100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZUp5fr+XU4qC6WEjdRF6ZQ5aZDG2ra/5otDx2LFjshc=; b=G/xzcAfimO+WifEDrvG0qgNESj/qcl9kn41xJvq+jjmNdUsl5B0VwL5q6yhC0U7VoCd5Z5 kEbpOAVm7t0D4t2bXG8Dd3YE/eKkn4gptbZpv/gvZGI9Ect9R1ThvpYX1StCl5NE4Y4PdF CMEbUTDhIcqDU/2w/Gq3R/F8/ll9O7XdkwdtifPzAvVjNzI5eb1HS+WEqhTdFY18I7gkQ9 6iriwKy2XN5ySY2Ni0umn+DbYUKK4igwbbeFwd/+49Ge34cr//t6/pGYt8P3gUdWYDlz6C njrOiWzKtS8TtrdI/YpESL8gyuCeM8p/TaYge0SU/0mVo4/elL2zBATr28nMdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680983100; a=rsa-sha256; cv=none; b=AWz9muWZWdtiUXqUmakBCiScFW06pPxkgLT4aF0QSlELDwT+r3aYj/B7nZ04HWb68Ma0he vGpW6AL7DOTalOLJ64mBHYqWTaCGqaInu7EWz+GiL6xjnsZwAZMCqgzu3q8CMjznS2IU88 vgsfs9o5V6D+9cESnNVasV91oj1fnKu2rVS0tRGsk2DoXcO4LKvXOSsnnqx4d3EzAf913R PpzKQLnWHTnaK8ly+38rCn1k5yBB53CUl7Y9/UmBHVrLBw3rc+VG3mKBf588Nc4XyNxiwn c7FhQjqGL204aooPgGxlbDyuyDKbLGxz1GUBFTn3X56tF9R1EtazSdDYK0Ckpw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pv5L4168czfsw; Sat, 8 Apr 2023 19:45:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 338Jj0F3018876; Sat, 8 Apr 2023 19:45:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 338Jj0nP018875; Sat, 8 Apr 2023 19:45:00 GMT (envelope-from git) Date: Sat, 8 Apr 2023 19:45:00 GMT Message-Id: <202304081945.338Jj0nP018875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 3c1ba1f1122a - stable/13 - netlink: check result of sooptcopyin(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3c1ba1f1122a95980593df4629f1da22fb7d6d55 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=3c1ba1f1122a95980593df4629f1da22fb7d6d55 commit 3c1ba1f1122a95980593df4629f1da22fb7d6d55 Author: Alexander V. Chernikov AuthorDate: 2023-02-18 17:15:25 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-04-08 19:14:11 +0000 netlink: check result of sooptcopyin(). CID: 1498866 MFC after: 2 weeks (cherry picked from commit 3f70fca90f9f1c6a40e55e6edd2dc1b1272f4998) --- sys/netlink/netlink_domain.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/netlink/netlink_domain.c b/sys/netlink/netlink_domain.c index 89de379c2e5d..c9e51cd98ea6 100644 --- a/sys/netlink/netlink_domain.c +++ b/sys/netlink/netlink_domain.c @@ -623,7 +623,9 @@ nl_ctloutput(struct socket *so, struct sockopt *sopt) switch (sopt->sopt_name) { case NETLINK_ADD_MEMBERSHIP: case NETLINK_DROP_MEMBERSHIP: - sooptcopyin(sopt, &optval, sizeof(optval), sizeof(optval)); + error = sooptcopyin(sopt, &optval, sizeof(optval), sizeof(optval)); + if (error != 0) + break; if (optval <= 0 || optval >= NLP_MAX_GROUPS) { error = ERANGE; break; @@ -640,7 +642,9 @@ nl_ctloutput(struct socket *so, struct sockopt *sopt) case NETLINK_CAP_ACK: case NETLINK_EXT_ACK: case NETLINK_GET_STRICT_CHK: - sooptcopyin(sopt, &optval, sizeof(optval), sizeof(optval)); + error = sooptcopyin(sopt, &optval, sizeof(optval), sizeof(optval)); + if (error != 0) + break; flag = nl_getoptflag(sopt->sopt_name);