From nobody Wed Jun 08 17:07:11 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 0116D831BDA; Wed, 8 Jun 2022 17:07:12 +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 4LJDDJ4fGQz4lGN; Wed, 8 Jun 2022 17:07:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654708032; 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=BroS9bxqpVwZUSw/5YyKendkpwjgbS2Elfl+2BhD9IE=; b=Q9AixgHL3x/kRSr073QaDaw423AxSuIaLF3TxVXmXGWDcNlZ4uh0t2lTUAUGUVnHVXtWm4 0BJ0GlgzbQIWVXSLXKTBJ+g7AZ33ajXZ9ubisrC2PbVJOBSZgea3l9KBkUCP3ftH8dqsb2 zV6jpFzmLb1M67bDb+/6MwTSvtcafjh72i/lBIXFIz0tel9/I3chQ/fClhkGGEIislTlKo JUChPMwHja7FGz8Ot9BWyyYIBchu4EAozbYJP0FQeUoql7UgdQDmQ3Cmd0ENMmHOnO0Scv hhMJvWlkwwTr2qzMJF9z3l/1bEbq/wPjmC4Kz4P35dc//DJz0zLJvhjhKPozoA== 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 00FA813A76; Wed, 8 Jun 2022 17:07:12 +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 258H7BGB089076; Wed, 8 Jun 2022 17:07:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 258H7BQt089075; Wed, 8 Jun 2022 17:07:11 GMT (envelope-from git) Date: Wed, 8 Jun 2022 17:07:11 GMT Message-Id: <202206081707.258H7BQt089075@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: 8a4d4ffde5e2 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8a4d4ffde5e2ec8b3eef9a8118711640c6c2547a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654708032; 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=BroS9bxqpVwZUSw/5YyKendkpwjgbS2Elfl+2BhD9IE=; b=hzXmxRPFPjzksCnxQ75/xmOZJ/t8MstqgyICklTNuZbKXKMagQOOE0ZDsu1G4HUD0S0h8z 2aVTU2pZAjAE+iIXf88M7lTaBYxAbIMpgSELhC6Q5coKztFZ8PBp/4Eryb09FSN2yF5MUC eggQ7ueP/BPLfRfeMiaDVzvksNvPp23/MRhnPW/8by4HnC+O96UWpl+L15xEfvUVKE0k2a rT5W2S7cYFkASV1Kmqr1xJBHglPrrC825yXV3EPkCqxLydggDXCxdpTb86ruNXTaYhAnIJ 74y/g8O8G4GDiVrziJuBCF5FcSwb8dCvWnd4cSPLmJQHvZAXRzk1ozSNgnqoqg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654708032; a=rsa-sha256; cv=none; b=isTu3UpLx9qW0n43vNBLqSX3CeKxLGOt0JOC/ea4q8hbH7oaz1T858SaE8ZYdayvjlUfpf S6Rj3L1ChYgMtSgsjQlUBEFtHL2CcCH7Aw5yJIhopdfo0YC+7c82mU964suZwBq1FRaT2b g84504OfnG4hb9W3TUlt+W34u8koQkpvAr7CIsS/yegt5cgmYRLIBrW8Zh/8AbTN2OzJW+ Qd+bA/0PU10E1BKHu3LddyOgIuy82uL6Q/ZG2MqAylbUp2Ql8uKPgP7uEUVHAwHnfp5zSe LR3mhm8qKCarOGWT/i1xFC97NkQfucML67Uz3U5SQi9fyW/rQR5kIDBCjFqdsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=8a4d4ffde5e2ec8b3eef9a8118711640c6c2547a commit 8a4d4ffde5e2ec8b3eef9a8118711640c6c2547a Author: Bjoern A. Zeeb AuthorDate: 2022-06-05 18:07:48 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-06-08 16:11:19 +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. (cherry picked from commit 728afa885f04f6316bc9ecf6498f4a635ced1e21) --- 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; } }