From nobody Wed Mar 30 15:49:46 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 98C9B1A54479; Wed, 30 Mar 2022 15:49:47 +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 4KT9qG53CMz3kMW; Wed, 30 Mar 2022 15:49:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648655387; 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=eEXQmFTk1lodoklOoLzUDDdKktG6cIYH8jUNyZ/GmXE=; b=EfukGjRe97KpLSV0v33MfRde/Y7/alsqiTPEkBqURH7OLlJONCteLmE0TKHVvnGP3c9vSQ dpXMzOvTvsAvyBAfs5Bdb/gIsVz+F00cp7ouoB9hrtcqGNCdsrI8fHm7PuQxg9guTYCVfP nCoNXxXzxh1/Gr6yer6zcv7SjExYZLvkF3kPPSoO+/BXQ4acrC6c21TgTLc56IAPUZLqR+ eUTr9gSLN4/WjfweuwpWBDoutpFejs2BstwP77tIFTCBBC6pDJ7ZpzPamrYIe6nWQxC+hD PbVcEGsKpc4oxh0b6I2xl/rPa+zZN//3lk6UMlRL4BuJGmEP9wQrBpGYkKh6IQ== 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 6F9A515F19; Wed, 30 Mar 2022 15:49:46 +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 22UFnkiX019306; Wed, 30 Mar 2022 15:49:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22UFnkM4019305; Wed, 30 Mar 2022 15:49:46 GMT (envelope-from git) Date: Wed, 30 Mar 2022 15:49:46 GMT Message-Id: <202203301549.22UFnkM4019305@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: fef73ef9c2e0 - releng/13.1 - LinuxKPI: skbuff: fix skb_queue_splice_init() 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/releng/13.1 X-Git-Reftype: branch X-Git-Commit: fef73ef9c2e04fab3ccd07b16a657754744d6319 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648655387; 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=eEXQmFTk1lodoklOoLzUDDdKktG6cIYH8jUNyZ/GmXE=; b=PbZbu5FUi5B55/+pCjC7fmr/A3ORps6GibThMI+nHvl47eoq2aWxLjX+9L/4WbubzHvQz/ Ys8W/U7EvVZW+Gf9jBNPoi/EWhis2eIuxTx+hZLSW8Y4eGlpt5dlinfpP7054OaOhYQSOd fZWSbvxGXfx9fY2HFUaqP7rAlJnmP7eShMDi0a6AYnlX1Jgh4X7Ex17qYBBfpNSw0MJGYI hX09FmbvTJe0dXq8Q3xSqSqOiE5//b0BzzUZEZ70Hdf3do6P5ThvZ4uMXsSmhUhmqLkpFY roeS92h37FcRO8GSlndvDDJI/SDIybSlKzcF6a2cMz+0HX1MBIU0AVr2QAsMvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648655387; a=rsa-sha256; cv=none; b=Y3+X0DzMA+zvCG2vBTPXceMK6FmNyEQ5BlYEuqWISKnA0DCWWrX5I4xq+oX1ehNhHVoUM7 h6//8ptYPg11NLTgHjM1H4ab7KG9dgraSMU4w6X/khg7K6w6Nd6uNxMtYzhMI1OwJljQVE kfwoaeqwCo8FiFxIVz98W4SqIcD4STViSEj5vaGyxJhv9r+TiFLzNAwfU7lqVlh99N6qq/ 0E3vX+iF6+j1LzYfx4EDtPzkdQ2eKJAgDvcBUOpQUVmqQnacq9ssANoReDgh5VnCmuq7t/ FpwD+mWUejIVpJmapDPaPp07lgyEROemhKqWLgyczNFALZfT3+9KWJToAQuM9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=fef73ef9c2e04fab3ccd07b16a657754744d6319 commit fef73ef9c2e04fab3ccd07b16a657754744d6319 Author: Bjoern A. Zeeb AuthorDate: 2022-03-23 17:05:43 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-30 15:47:25 +0000 LinuxKPI: skbuff: fix skb_queue_splice_init() In skb_queue_splice_init() we set a next value and then used that new value to further update the remaining linking rather than the original value. Introduce another temporary variable 'n' to hold the original value and use that. While here rename q and h to from and to as otherwise it was too confusing to read. Also initialize skb->prev and skb->next to point to skb itself if for nothing else at least to aid debugging. Approved by: re (gjb) Reported by: phk (panic in iwl_txq_reclaim) Sponsored by: The FreeBSD Foundation (cherry picked from commit 6a8973c3324c0c6c270ae4ad371e50c0ec5761da) (cherry picked from commit 32d1d7fee61328e65ae944836d1027335ccb979c) --- sys/compat/linuxkpi/common/include/linux/skbuff.h | 25 ++++++++++++----------- sys/compat/linuxkpi/common/src/linux_skbuff.c | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h index be93032c7561..21ea7ee560e2 100644 --- a/sys/compat/linuxkpi/common/include/linux/skbuff.h +++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h @@ -762,26 +762,27 @@ skb_mark_not_on_list(struct sk_buff *skb) } static inline void -skb_queue_splice_init(struct sk_buff_head *q, struct sk_buff_head *h) +skb_queue_splice_init(struct sk_buff_head *from, struct sk_buff_head *to) { - struct sk_buff *b, *e; + struct sk_buff *b, *e, *n; - SKB_TRACE2(q, h); + SKB_TRACE2(from, to); - if (skb_queue_empty(q)) + if (skb_queue_empty(from)) return; /* XXX do we need a barrier around this? */ - b = q->next; - e = q->prev; + b = from->next; + e = from->prev; + n = to->next; - b->prev = (struct sk_buff *)h; - h->next = b; - e->next = h->next; - h->next->prev = e; + b->prev = (struct sk_buff *)to; + to->next = b; + e->next = n; + n->prev = e; - h->qlen += q->qlen; - __skb_queue_head_init(q); + to->qlen += from->qlen; + __skb_queue_head_init(from); } static inline void diff --git a/sys/compat/linuxkpi/common/src/linux_skbuff.c b/sys/compat/linuxkpi/common/src/linux_skbuff.c index 0a4974d74d9d..efb97fa2f126 100644 --- a/sys/compat/linuxkpi/common/src/linux_skbuff.c +++ b/sys/compat/linuxkpi/common/src/linux_skbuff.c @@ -86,6 +86,8 @@ linuxkpi_alloc_skb(size_t size, gfp_t gfp) skb->head = skb->data = skb->tail = (uint8_t *)(skb+1); skb->end = skb->head + size; + skb->prev = skb->next = skb; + skb->shinfo = (struct skb_shared_info *)(skb->end); SKB_TRACE_FMT(skb, "data %p size %zu", skb->data, size);