From nobody Sun Jun 05 18:11:39 2022 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 A3E7F1BEAC7E; Sun, 5 Jun 2022 18:11:39 +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 4LGPp33j1Yz3Dx4; Sun, 5 Jun 2022 18:11:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654452699; 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=M6L2LY5CnxqtL/MIFC5eI1xlIZEodmqcSyDiC/GXfFo=; b=a5UeuEnS0Do+BZ1GiLsoUR+8xZt6vfE/b5zOMwJfI3XGVEYHw5asURURIKLL5d3A/ORYRt ifqFpq5ZH0hK/GS4hrrgLmr40omIuE9f8EfCfEd8BN3dU82Rm50aKI2rAgLoRJ1XKCaZxL aTqjLQKvpfQVzw015qtXq702tZ2dO/bJ/ecP7txRAccKsz/nAMoGzMFuvvZ3HXT3oLx7AH Ve3v6B/NmSvCYAlI5qxG2N1uFXSBcrhyMGuoc2tBaCgCb1hho9pb0tp10oa9nxeNhJaRvs TTX15cJdvQOckS3NclyAbhInQwdYembDbpAw/DPXQz8vvj77nqRykfxkYpglBw== 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 43CCC16D2A; Sun, 5 Jun 2022 18:11:39 +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 255IBdDH037881; Sun, 5 Jun 2022 18:11:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 255IBdmA037880; Sun, 5 Jun 2022 18:11:39 GMT (envelope-from git) Date: Sun, 5 Jun 2022 18:11:39 GMT Message-Id: <202206051811.255IBdmA037880@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 728afa885f04 - main - rtw88: plug various skb leaks in error cases 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 728afa885f04f6316bc9ecf6498f4a635ced1e21 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654452699; 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=M6L2LY5CnxqtL/MIFC5eI1xlIZEodmqcSyDiC/GXfFo=; b=wLEcT40dQCRFFo5iRRvy3IzPTY7SVo6MI0RiC6pBaRLrHqsOT2cpT1uyyaI79NHLlxM43X LcPZb0Z3JZ6dMLfrMSHCp3ql4JFzX6JnsP4CkEPd2mixaYgidnDkw5qlK3V5xtRIBgvpLu pzZhc0nSxHC8le3iB/vgWTVk0J/VMQ+CIvGXQFPIMCMbkuvPiTZXsIJfgrgHZcolukwnZ8 RDB4VSk7XmixmIUYnHpKLyQPFiAxZ6DkuAxkXT3Lg+5urS49I2Wws8qk/9RifXfKTBjW/9 rLDHORSaXcjrtX02vqP482Axo6yq4OAdC0/enA4ivJbn1gl5xzxPcya3sP1QkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654452699; a=rsa-sha256; cv=none; b=EqMB4AOxvSCMhraI9V+Y1S6GjmxGlCCxWRzMY2NK5uEkAkbxUowEW57PM2lBzCvayu2pYm Jmz09e8RtWOm51W0009uvF0JPeE+adV2ioHiOLnC920LWAVmO3coAn8vcoEDCYqBhw4qVE IZLUvjKj8PJllsjAopC3qGdjxe9+6kMdxjblejPFQvZflv3Sid5ydU3IXz5WB5ipRC3Lgn IUZJ6qLFyMsnYx0ynjpt0QcfsIIVK8agHgu1jRgGvNpQAZiL+1XUlz8SneWfPkQlbd61Yj XCkXuv+QLMIqLWNHZJ8CBg1wUy35VJ8TGu6ziZ+/7s5YwyfpzGkmUoLScJtzHA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=728afa885f04f6316bc9ecf6498f4a635ced1e21 commit 728afa885f04f6316bc9ecf6498f4a635ced1e21 Author: Bjoern A. Zeeb AuthorDate: 2022-06-05 18:07:48 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-06-05 18:10:24 +0000 rtw88: plug various skb leaks in error cases Based on manual inspection the skbs are not freed in those unlikely cases, though all would give an error message so would have gone noticed if happened. While here fix a typo in one of these error messages. MFC after: 3 days --- sys/contrib/dev/rtw88/fw.c | 3 +++ sys/contrib/dev/rtw88/pci.c | 6 ++++++ sys/contrib/dev/rtw88/tx.c | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/sys/contrib/dev/rtw88/fw.c b/sys/contrib/dev/rtw88/fw.c index 2f7c036f9022..e1837ea6a13c 100644 --- a/sys/contrib/dev/rtw88/fw.c +++ b/sys/contrib/dev/rtw88/fw.c @@ -1825,6 +1825,9 @@ static int _rtw_hw_scan_update_probe_req(struct rtw_dev *rtwdev, u8 num_ssids, skb_unlink(skb, probe_req_list); rtw_fill_rsvd_page_desc(rtwdev, skb, RSVD_PROBE_REQ); if (skb->len > page_size * RTW_PROBE_PG_CNT) { +#if defined(__FreeBSD__) + kfree_skb(skb); +#endif ret = -EINVAL; goto out; } diff --git a/sys/contrib/dev/rtw88/pci.c b/sys/contrib/dev/rtw88/pci.c index 13e71f44d84f..431d0c1c8b98 100644 --- a/sys/contrib/dev/rtw88/pci.c +++ b/sys/contrib/dev/rtw88/pci.c @@ -965,6 +965,9 @@ static int rtw_pci_write_data_rsvd_page(struct rtw_dev *rtwdev, u8 *buf, ret = rtw_pci_tx_write_data(rtwdev, &pkt_info, skb, RTW_TX_QUEUE_BCN); if (ret) { +#if defined(__FreeBSD__) + dev_kfree_skb_any(skb); +#endif rtw_err(rtwdev, "failed to write rsvd page data\n"); return ret; } @@ -989,6 +992,9 @@ static int rtw_pci_write_data_h2c(struct rtw_dev *rtwdev, u8 *buf, u32 size) ret = rtw_pci_tx_write_data(rtwdev, &pkt_info, skb, RTW_TX_QUEUE_H2C); if (ret) { +#if defined(__FreeBSD__) + dev_kfree_skb_any(skb); +#endif rtw_err(rtwdev, "failed to write h2c data\n"); return ret; } diff --git a/sys/contrib/dev/rtw88/tx.c b/sys/contrib/dev/rtw88/tx.c index f405682c9cbf..a85f09a8d7b2 100644 --- a/sys/contrib/dev/rtw88/tx.c +++ b/sys/contrib/dev/rtw88/tx.c @@ -638,7 +638,12 @@ static void rtw_txq_push(struct rtw_dev *rtwdev, ret = rtw_txq_push_skb(rtwdev, rtwtxq, skb); if (ret) { +#if defined(__FreeBSD__) + dev_kfree_skb_any(skb); + rtw_err(rtwdev, "failed to push skb, ret %d\n", ret); +#else rtw_err(rtwdev, "failed to pusk skb, ret %d\n", ret); +#endif break; } }