From nobody Mon May 20 07:39:18 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 4VjTwR14CYz5JbtS; Mon, 20 May 2024 07:39: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 4VjTwR0KW0z4d2h; Mon, 20 May 2024 07:39:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716190759; 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=4n3X0i2iHaAvEcY6UFedUuowNo2rABaChiISlD7YPK8=; b=j2yWN6d7VXImr464zSWzeAmClM3wjoRPXGYUa/iwxxdOJjjXSBi1+/YwytCdQeU2hD25s7 t6SZzsaxrgZwC/f6QLuL21XJqWPQ6IlYghEOxTL7sfCMmjyr3IiquUqfO8QyPRgIqFrSLX 9b40oHJLLSkZpUPPbLHQyjhu8bAh9yDgY+uIUqq0wU+Hdalajm8lqW5F9atKyf/vFHRUgj joHchAriMF8Szbv5Uft8dmxKxRHH1hI8XmAObLBEDj4z55GkVkmek+ZL1sq3+04cVZzdY7 kkdWSGHIx7pf+dEv+AQlpoB8jr4JyIJzEWefERFJSHyZ3a/FP9FtUIuQ+BpvXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716190759; a=rsa-sha256; cv=none; b=GfFKlgKNhx0d31qodJWjuT3bVhCAGFPoj1gvz2uDrdJJ2epIjnQslBSxe6TDCFhPLgGbGe DC/roN54OlOuAPqbqOTCI6dGRFR1un+E1BVjD2e1brGOlXWoskkPeq+Sak/59t72wMcvJl gb2GqpWqHACrW0tkzxBEAvb9FXTeXFn7F63kb1XsHhqfLmERVYI8oA/Q/L/4Hcd7qmhoXc L68ey6H01Db47x6XHZc3G4G74kg60YWEUxkuK29j+2S+yhYlec+ymLH2F6H8Ea1KbJSwdG UZ2ZNtF+j+7m2BpWICR3U+4bow8wtotFR/MKJjuK/SoqkxRQfx/d5CgZ76elXQ== 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=1716190759; 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=4n3X0i2iHaAvEcY6UFedUuowNo2rABaChiISlD7YPK8=; b=BtvGQ+gQ3PIGqsROKYuJoLcmKI52e+jISniJyPDDLzZSeDYRULtstHVCqUVlDeOIEZjZOY GVCnmBSs7vtUZpAZvYCPKLYX3kdv7GZdwQuitCkZ7g5+JkSzlQ08vH3AhlMANCMi+HGoVM gLjWSTIn7WWyW4SiYbIeERoMgB7K2AOo0xtfL2oplRxfsJNm1Xi/nYw+GXNgT2sCCoM6Xs ZH2S9/hoqikuhkjKbuaqrmcSZy3iEGUQCL3XNgehTJN4NPHZMmOsknlKX65V2adHN+9VX1 0CDliDy8Y/m7lEg/vAOqm4N5smeGK/9OaQfbsvizhwOCuqLG5p+DlSBrFyZtUA== 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 4VjTwQ6VC6zV9P; Mon, 20 May 2024 07:39:18 +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 44K7dIgr037661; Mon, 20 May 2024 07:39:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44K7dInS037658; Mon, 20 May 2024 07:39:18 GMT (envelope-from git) Date: Mon, 20 May 2024 07:39:18 GMT Message-Id: <202405200739.44K7dInS037658@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: fecd30388256 - releng/14.1 - 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/releng/14.1 X-Git-Reftype: branch X-Git-Commit: fecd303882565954f58d984e4a13735e080b5263 Auto-Submitted: auto-generated The branch releng/14.1 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fecd303882565954f58d984e4a13735e080b5263 commit fecd303882565954f58d984e4a13735e080b5263 Author: Kristof Provost AuthorDate: 2024-05-06 09:39:08 +0000 Commit: Kristof Provost CommitDate: 2024-05-20 07:38:40 +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 Approved by: re (cperciva) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 43387b4e574043b78a58c8bcb7575161b055fce1) (cherry picked from commit 9a8a26aefb366ef6f497d48547a1562a1de566c1) --- 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)); }