From nobody Mon Mar 04 14:34:33 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 4TpLn55XGwz5CjMV; Mon, 4 Mar 2024 14:34:33 +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 4TpLn54myLz40lY; Mon, 4 Mar 2024 14:34:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709562873; 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=7niOba8woMAYcad+kG9mEPHCM91T6+EG8coUSZvpNpM=; b=NppHKzb/rBSG6CXXmQYkWOJ+LFNZKhQeOigNDugOu89Od34PqaPOGlKA0B0f7wLg0/KIXp UGAibJQohXp2OR4WX3T38JUS9iag7OVhiWNIhedCSaa2DqnqZjIpSp9NuedQ+OMFD0KOZV AjHBsCQojPuXHpjRGXkWfxdyS06EVIFYqo6/HxQUqoOJgZqxlMJ1u6Godxk5KoNA+3FIka CzlnpG0sTHjweNrU30Xr5+oPFiMhLERoyuRBUVekODfq3Aik2zLUZ7wkD5aN8+Yfnop5eN bt9EnQwAasYpuqBdYq82/0OSoKVsO7qc+qkrNFcmWx0U/Ln4ssb7eaxrKcDWOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709562873; a=rsa-sha256; cv=none; b=SaZMKsIQ+D5/YNOAzWkejLiiDYFJZLvdXIJeLb1kndcIX4crfaZZMp5DPwWvseqjISc//K 55BAtfmebO3ckalPBtY0GOi+bTTqHOfxNQaevHXhW7MUMfU9R+QrA3DkAjq6fSnxtMH2G3 dyHs36+yjocr137ILRUjG6huRB1EMxwrU0bTha7VSS7FbSqkOdMdnPAbX968vEId8Hm3rU lqWEEU0V8BEf5EFLVSzwDuGJkCsgTCoS0Irok2QTo8OUAHV+KwRjAulm0NA4J8OtTyvz8o EzTtRpjIGZvF1PjoD9lvYkv04h23aMJKMGFypMNvEkRTu9GwLjFZitFVMloZDQ== 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=1709562873; 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=7niOba8woMAYcad+kG9mEPHCM91T6+EG8coUSZvpNpM=; b=T9WAYEAY1V0eRPieW0vUfrELn1OnYe8GRR0DehVTdyp0HBJ6kRbxOQwac5+x2IS8nHhSTt 3BJ32aiV8XyvMA7rgHfO2e20beOWxvd9Y5VSXiM/xtL2RpYEYFlM24sgmjYSsmLRCKQE71 gOfq1E225AbJbCaMEPZWpY1KqW+NJjGAU/0aQKg/OM9/YXh79FaBNS3Bb6aovC3N28eSk6 kKX+RbSy/GXU6ynQNEO3Bo0/XbRPqukOguMZw0mLi1THCff+7NosSKRmIFitWhYMKb4b6P qhjgOn+3DnyWv4BwQZnBeUTouwrztr5cyckBUX+AFW5O5vG/lFRHQCZrbpyvlA== 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 4TpLn54FtGzPxn; Mon, 4 Mar 2024 14:34:33 +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 424EYXbq074676; Mon, 4 Mar 2024 14:34:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 424EYXcR074673; Mon, 4 Mar 2024 14:34:33 GMT (envelope-from git) Date: Mon, 4 Mar 2024 14:34:33 GMT Message-Id: <202403041434.424EYXcR074673@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: d3befb534b9c - main - LinuxKPI: Queue skbuffs at tail in __skb_queue_tail 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3befb534b9c8cd80f1b8d75ce6451e3f62b8ba9 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=d3befb534b9c8cd80f1b8d75ce6451e3f62b8ba9 commit d3befb534b9c8cd80f1b8d75ce6451e3f62b8ba9 Author: Tom Coldrick AuthorDate: 2024-03-02 19:22:55 +0000 Commit: Ed Maste CommitDate: 2024-03-04 14:33:12 +0000 LinuxKPI: Queue skbuffs at tail in __skb_queue_tail Correct skb_queue_tail to queue the buffer at the tail of the skbuff. The skbuff is a circular doubly-linked list, and we call with a pointer to the head of the list. Thus queueing before the head gives us a queueing at the tail. As a motivating factor, the current behaviour (queueing at the head) was causing frequent kernel panics from my RTL8822BE wireless card, which uses the rtw88 driver. Interrupts can cause buffers to be added to the rtwdev c2h_queue while the queue is being drained in rtw_c2h_work. Queueing at the head would leave the nascent entry in the linked list pointing to the old, now freed, memory for the buffer being processed. When rtw_c2h_work is next called, we try reading this and so panic. Reviewed by: emaste, bz MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D44192 --- sys/compat/linuxkpi/common/include/linux/skbuff.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h index f8ce212e7853..02190a29e241 100644 --- a/sys/compat/linuxkpi/common/include/linux/skbuff.h +++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h @@ -567,7 +567,7 @@ __skb_queue_tail(struct sk_buff_head *q, struct sk_buff *new) { SKB_TRACE2(q, new); - __skb_queue_after(q, (struct sk_buff *)q, new); + __skb_queue_before(q, (struct sk_buff *)q, new); } static inline void