From nobody Sun May 12 16:12:19 2024 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 4Vcnh35LJKz5KH80; Sun, 12 May 2024 16:12:19 +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 4Vcnh34nFvz4RPl; Sun, 12 May 2024 16:12:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715530339; 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=Kz+diMJvpSY6h5UeCJgr5MOx63jKKCz7EZ4QJUS06H0=; b=F29x0fuCYAspI/Pd47i9dlQfEVV9taoLlL/XHGJxBil3TcrxgiZ4RloAnct1Nh0sIULGQf fco6MwHS3ZT95Uxfvo2sPrSrMBsi0GLMdpUN6lKCexDu/q709vXkB8ysfY8CCPIkGyWWoB 4lcrCn6YekY6ieow6SOQWp0dJ7AJ1Kp1EhzWpw4XBo8D24V2qvm4DfTLSIti2KOCa1JgQm BIng4n8OlpOFcsVvuRO4cRA0KwjsnuVdKhYprDwKVgPk9x64WenVOu6i9UHa00kMozQfb7 wNz08dST+TO+AKJUtMnPWvCPH1osr6n8FldZ2BBg+PjGmvsoHqzV1B6sBz1T+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715530339; a=rsa-sha256; cv=none; b=rpHXnCjMNVuY4sG6J6Iv1yIwpCOyeDwJr/AHckAWrNqkxhkciCP8fZxVVs+D18Dh++xWIv 3aidfewpR+wl8mkou4qtX2lESi/q8GUXfO5JZzaFmsSCi3nXqj1S6CaV4rqnD2vnlQynS0 lujcRaBaGKgXHrL/+ewZnAiuHyNW6KhtGTa6wIrCFb4Jv9Q/ezP9/oysvbJThwuB/Dsw+n J6o8xAOk56CgDlu0rsFbgTsaS73NwZaavOZopBcimIOAmttnaYfjpNfvcvHDWRYVeN3n7G Vk1B1QsyhwNQkW06TWxIRtkkzcEMXKo0lL23T1M5P8W3TgaVBdPPn95O/C6BJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715530339; 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=Kz+diMJvpSY6h5UeCJgr5MOx63jKKCz7EZ4QJUS06H0=; b=qnCWkk8pWvI7RiaW+yTbakXDx6NHgkMfKeQq4yPLMRA+7XPpkWPBAD2G50a941J1oLwXLr u5pscKJ+Q8O1fJoepjUFnL7ZYIBM50s1DabukEoRLBcZ044SisgJQJnQzGHYDVL4RmpGar SB/NsSjqwyMi6lWNU6qGPIPaMMskr2QhKkYIy06q4Cg+CF/euKTx6OeEESYi4Ws/i2KVM9 WNwdJie6M8Lv6Lx51wYfIaRxIGhM2rR2HFcpGM4kKYsIMjkvhw8NQTJj3gZ0whzgOvbVqe 8EPNsJ8jj0XAt2WBzoVCSrkwNOHLQ/VW3DoQFb9s0oyqwTrHw5/H9M9UUseP8A== 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 4Vcnh34Nlyz1B1H; Sun, 12 May 2024 16:12:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44CGCJ9B041686; Sun, 12 May 2024 16:12:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44CGCJ2L041683; Sun, 12 May 2024 16:12:19 GMT (envelope-from git) Date: Sun, 12 May 2024 16:12:19 GMT Message-Id: <202405121612.44CGCJ2L041683@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 9a8a26aefb36 - stable/14 - if: guard against if_ioctl being NULL 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9a8a26aefb366ef6f497d48547a1562a1de566c1 Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9a8a26aefb366ef6f497d48547a1562a1de566c1 commit 9a8a26aefb366ef6f497d48547a1562a1de566c1 Author: Kristof Provost AuthorDate: 2024-05-06 09:39:08 +0000 Commit: Kristof Provost CommitDate: 2024-05-12 16:12:04 +0000 if: guard against if_ioctl being NULL There are situations where an struct ifnet has a NULL if_ioctl pointer. For example, e6000sw creates such struct ifnets for each of its ports so it can call into the MII code. If there is then a link state event this calls do_link_state_change() -> rtnl_handle_ifevent() -> dump_iface() -> get_operstate() -> get_operstate_ether(). That wants to know if the link is up or down, so it tries to ioctl(SIOCGIFMEDIA), which doesn't go well if if_ioctl is NULL. Guard against this, and return EOPNOTSUPP. PR: 275920 MFC ater: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 43387b4e574043b78a58c8bcb7575161b055fce1) --- sys/net/if.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/net/if.c b/sys/net/if.c index 0128fb8039ee..1ca0893eb724 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4873,6 +4873,9 @@ if_resolvemulti(if_t ifp, struct sockaddr **srcs, struct sockaddr *dst) int if_ioctl(if_t ifp, u_long cmd, void *data) { + if (ifp->if_ioctl == NULL) + return (EOPNOTSUPP); + return (ifp->if_ioctl(ifp, cmd, data)); }