From nobody Mon May 06 13:25:16 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 4VY2G50pcTz5KDDZ; Mon, 06 May 2024 13:25:17 +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 4VY2G50FXxz4GCc; Mon, 6 May 2024 13:25:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715001917; 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=ObbTvkWkkLRyEJCmbxBOB6Pmx8SmVqRhFDJrO81piyo=; b=r0Wv/2TBKlhvotxeTBc9B79PCg9xUIOqB7CPSW02BhER9o6YicsjSrZSq12a6n4pG6496E tvvjIu5vkfIpNrLuThmKfyppUDSuH7wIznw3BW0hTtkzF/NUS51wAHHavpR21Byxb2Q/pO UBsiZAnsUnVpDcPS9y8FEmvdSIoHmwibTQJcT9PqItEdxYlpNyhm8jSFArRxjMGTV/4Yu2 6nEmELkJn8rkwyAHOhWHDA4awdloD+LRCURxi6+BA3mWES/OHMnatZiBGabvSSilCj045Z AvkcLind6ZhIaroOnAX+jXLSC/YA6mzhYzA4gqnJbeypzbFrSE4cjBgfLvtxSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715001917; a=rsa-sha256; cv=none; b=lA2X2cPqE7IvjtRqpSdpB/m9SwN8nnrk0ptZa4CMieZoQJNRBtBfC/mMMBZhTJv/MkvncV YtZS+rhSqZWGd9A3pTP8Q7Qg+xO1r1ZnGqDreGWXzi90hm+CVBtmTT8sQ/7i7CjDwBYihA jQZ6u84ilgkgOfXkScd5ijczn/Ky20t3ZTaBhC+0zsVUYbDwVYxtthMf/oF7XX3MmHYSjp 7A4tsaUjU5dwedF6pcbmYiTYuCDdbgTBDuWwNmZA2m3o0ZxzUCmr63BgUFpxL4HYOLC3Ku +ujsZ9qaHtHdG1P4hvcwg88pfEf8PQLFi5mJ+fFbc1Qp0ayKG6fG/jFp6MTYkg== 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=1715001917; 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=ObbTvkWkkLRyEJCmbxBOB6Pmx8SmVqRhFDJrO81piyo=; b=SuOr/iZeRqyHBWX2DRqMTAugYExS5aM3AdGMxvNVuEDJiPzlmE5a7U34Dv9hqiijkCDISY 9bL6mhUhbJ/vPIDaHB2Slz24o6xBWXr+MEDseAwDeCjLG5c1isuPqCAOxtPLBgziCtYpw4 CmtFqof3IKkcd78xE/W9hBUh9NZV0/sydqB4RXdbH969Cg5sLpcmNwkiRB+YeU1+ozUvel 16EAsJn+ARYY0IjbLQt6eBca1xljRQ2IqmXvUFQWX6ysM/p0rqy6sEJnOr9fljcXOonkvJ WXHDiapQs0bFZYM9GlfK+yQYUis40GMFXX0lU3TeMGB+6QwQYwsBZfhaMnISWQ== 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 4VY2G46rVvzyyk; Mon, 6 May 2024 13:25:16 +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 446DPGT1034000; Mon, 6 May 2024 13:25:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 446DPGk6033997; Mon, 6 May 2024 13:25:16 GMT (envelope-from git) Date: Mon, 6 May 2024 13:25:16 GMT Message-Id: <202405061325.446DPGk6033997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 43387b4e5740 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 43387b4e574043b78a58c8bcb7575161b055fce1 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=43387b4e574043b78a58c8bcb7575161b055fce1 commit 43387b4e574043b78a58c8bcb7575161b055fce1 Author: Kristof Provost AuthorDate: 2024-05-06 09:39:08 +0000 Commit: Kristof Provost CommitDate: 2024-05-06 09:39:08 +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") --- sys/net/if.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/net/if.c b/sys/net/if.c index 9f44223af0dd..c3c27fbf678f 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4871,6 +4871,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)); }