From nobody Wed Jan 18 16:24:57 2023 X-Original-To: dev-commits-src-branches@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 4Nxrh95S0Jz2yJMN; Wed, 18 Jan 2023 16:24:57 +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 4Nxrh94zwFz3F6x; Wed, 18 Jan 2023 16:24:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674059097; 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=wOLB1GtlC4l8JJwjJ4k6RGywJD+xqdhm6IkCvfG9kHM=; b=sprdx+7AnUMpWuYuSL2Ykj4s8LVAwwKaqQ43vxg/26AdUAqy8x5Jfqgj4qENxIv0y5GOJd Ip9OZc30fofd6b152xLplz00HcLQ1MNg4iw4mME1/LKwfYHo2KHe4NX/pFxv5DvUqlnXgR o1X/OT7xMQWVOPyNUY4ajXuiZDxwF5jZgPKpajSlOmqagyYdCq+adt9zGUOFCGZx3hZJxj 8OfN9fkN6f9xG7mR+BeXLu9DnHBd27MtMs6TAzxeyoyyx9+N+70++V5NDz7eEde7uGANOK KaK+wRE2kvXYNNSI+gZZKyBRTlj9FqsmTruw/U1vsqbgR1vNL4sZXc4PF1QEtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674059097; 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=wOLB1GtlC4l8JJwjJ4k6RGywJD+xqdhm6IkCvfG9kHM=; b=aozowBzm/qdp7wQ7RDN2bcZcibA0QIi3Ky0KUobqsBRL/+LRBEAC87J6btAXblMx4a3nVK /ou9WQZCn+xuETKEa7HVit/w+Kxg2psEaqHSIqrgh3teSGfhM+a2VNYF7SX2KqFq6QfHnj q+RFDNEMpa1KH12yagHB6OIoWU0KlaGiYc6joIpVuolNrzwFfrIcArpvI8/S+mXgd2Au1k B9HosN32IYh0xLos0UTnFnM+ggAQpLiVA9qa9rzFuc7nIft7Xf7RoYew/vUSPrlX9ZGAGR H4x4Pl8FlPdI0hvwBnCDxUoCyCV6DDD01DIFE1oBGb21XaFkj9vGOT4W4F9+6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674059097; a=rsa-sha256; cv=none; b=LAHTh/SyqgT98trwKXr5xyiLDwi/OlsS/b3KB0m7Sj3LHpsYopBZS8Q67ZdxaP3EM8iKDU nngLiqU2LtzWKgjzuKxGNRzYmDDandMJK3vr+Zk+TSuAP8Rhm7B6U5sNFgLPp3oyTEDaId LHABN2aVsOmZH3hD/Ea9pj15GW4EjxCYjHwVFQV5P8Q4WN9ZFnFkCIzCWTn5zpkn2D6LGO VLWraiZuynawY9l21i6HlEfLKs7kXslxOXwpR3UEJ9BXkqH13l3/fOi38ya+MC3jks/yZt 0gBBZHSou6m5rmwWtzYB42qpgP3fm16ikBk0FJJT7mWpl9sR3nLot/95H5/KWg== 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 4Nxrh944wSzHSd; Wed, 18 Jan 2023 16:24:57 +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 30IGOveW038114; Wed, 18 Jan 2023 16:24:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30IGOvrR038113; Wed, 18 Jan 2023 16:24:57 GMT (envelope-from git) Date: Wed, 18 Jan 2023 16:24:57 GMT Message-Id: <202301181624.30IGOvrR038113@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 931d322d4082 - stable/13 - LinuxKPI: 802.11: implement ieee80211_get_hdrlen_from_skb() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 931d322d40822180237329cef442278eb078b370 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=931d322d40822180237329cef442278eb078b370 commit 931d322d40822180237329cef442278eb078b370 Author: Bjoern A. Zeeb AuthorDate: 2022-12-31 02:02:01 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-01-18 13:26:02 +0000 LinuxKPI: 802.11: implement ieee80211_get_hdrlen_from_skb() Implement ieee80211_get_hdrlen_from_skb() doing basic sanity checks on lengths (minimal length or skb data length vs. header length). Sponsored by: The FreeBSD Foundation (cherry picked from commit 339119949660916aa40b1d67dbe002dd7eb0d709) --- sys/compat/linuxkpi/common/include/net/cfg80211.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h index 8d69ff0891d9..b5135f34981e 100644 --- a/sys/compat/linuxkpi/common/include/net/cfg80211.h +++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h @@ -1666,12 +1666,23 @@ ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq) return (linuxkpi_ieee80211_get_channel(wiphy, freq)); } -static __inline size_t +static inline size_t ieee80211_get_hdrlen_from_skb(struct sk_buff *skb) { + const struct ieee80211_hdr *hdr; + size_t len; - TODO(); - return (-1); + if (skb->len < 10) /* sizeof(ieee80211_frame_[ack,cts]) */ + return (0); + + hdr = (const struct ieee80211_hdr *)skb->data; + len = ieee80211_hdrlen(hdr->frame_control); + + /* If larger than what is in the skb return. */ + if (len > skb->len) + return (0); + + return (len); } static __inline bool