From nobody Mon Feb 20 15:25:46 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 4PL5pg1BwQz3sxFq; Mon, 20 Feb 2023 15:25: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 4PL5pf74Clz42Zc; Mon, 20 Feb 2023 15:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676906747; 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=RtpRj/kP7h9HFNzi57Qwwp5LszITgqKxJMx65a1MU1I=; b=KF6XZe+ZHKCgX/n7goT+2Klvw4eUEGD3CuDp52xtzragRpnUm9E0XsNediEGmq2+0oHI8D IWf/7hQNt2TnrfT1eDfANHskJHpOhJLPG4KfxqQnCiA20e7CGtVdxBAYOYs/lu7vGkEFBN 4iOC2/jkRQfxHBMWl0BAh261C+8teYCuJL2/3UyD6cZ3BH1SZK+Xww1Zi5ET/E22cAfRbr ks7vyvsvCnuRV1C6TnlMmnXHU5Wyox1FQ89bMSy/AvKQVSIt5vuX7TpEUXJZiAnTTb8me/ KWz6N7Z6qNaPqyGdZfSpBCFi1Mw5Ad2CuYTxb07j18DaAc81X1PedE8IGc4k+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676906747; 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=RtpRj/kP7h9HFNzi57Qwwp5LszITgqKxJMx65a1MU1I=; b=prS+8GjLlimnG3WdeHc4KAFEDXMyo1yUrhgxdcDkQ0EuLPsL961veTVBPr2NTlFe/bO7WU F12c8pNZwMP4xXlVeFdM0o0IBg4AiZ7sxiWa300JexwNxB2k67Di13ojcVJP3i9BVOYymQ OB396bcC/wSiwc5KE1JdIW+u3FRX25zXwYz1Vt6Vny38GPdwNsrIhiGi8Wuv5bGR3Wpi+n /7mMCta+2XbLWzltM1AEnlX7GYBNYgWnmd0JcLLrTvvOYjcETz9DyrVQ+uc2OZO90mzVWp CG73fuuqUgxwKH0GvzvZKmaamr1X/8vIJosDLWbDUn5fFGE5UKuGkUkzSZJNuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676906747; a=rsa-sha256; cv=none; b=vGoldIDlR2e01sR7IFakyOvWEWjv/yxgk9JqNCC1wiQPHkPhsjVc0kqnyEttMJhOrHqFcx 4Ax7kN5Atgj4mNRDOuAfZCMFK3Ph2w0iIhRX5f+W/oWernX5SCuvxAN6lO0mh8bc1AuZVT zemVgYwBoZfiph5dF73wFxhV3w0QvW2JZ3ZqF9MQB9xUf2/KtRvfU6EaLLaEBLOk9x71FW hXitQ6lulJh3HVwoML315kI9Byt6Y872XNc7JzEb0Xd80wh9GKrhYKeeZjDVtYQS3iwK6g l4XWQtNBT20x4wsY4+xMnYAsZBer2BgMh1uXIeT5UJiwABN7oEeMPdyR4kolrw== 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 4PL5pf68Y7zmHh; Mon, 20 Feb 2023 15:25: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 31KFPk5H078292; Mon, 20 Feb 2023 15:25:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31KFPkXL078291; Mon, 20 Feb 2023 15:25:46 GMT (envelope-from git) Date: Mon, 20 Feb 2023 15:25:46 GMT Message-Id: <202302201525.31KFPkXL078291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 27ee5625a829 - stable/13 - nd6: fix panic in lltable_drop_entry_queue() 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: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 27ee5625a829acfa0db0e1fbd0b695fa91aadc6c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=27ee5625a829acfa0db0e1fbd0b695fa91aadc6c commit 27ee5625a829acfa0db0e1fbd0b695fa91aadc6c Author: Alexander V. Chernikov AuthorDate: 2023-01-15 15:10:48 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-20 15:15:30 +0000 nd6: fix panic in lltable_drop_entry_queue() nd6_resolve_slow() can be called without mbuf. If the LLE entry is not reachable, nd6_resolve_slow() will add this NULL mbuf to the holdchain via lltable_append_entry_queue, which will "append" NULL to the end of the queue (effectively no-op) and bump la_numhold value. When this entry gets freed, the kernel will panic due to the inconsistency between the amount of mbufs in the queue and the value of la_numhold. Fix the panic by checking of mbuf is not NULL prior to inserting it into the holdchain. Reported by: kib MFC after: 3 days (cherry picked from commit 6468b6b23e08d9bd02c8cb74ec0ff389ed74c3bb) --- sys/netinet6/nd6.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index be881b6291ac..de35127bd17d 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -2369,7 +2369,6 @@ nd6_resolve_slow(struct ifnet *ifp, int family, int flags, struct mbuf *m, struct in6_addr *psrc, src; int send_ns, ll_len; char *lladdr; - size_t dropped; NET_EPOCH_ASSERT(); @@ -2436,8 +2435,12 @@ nd6_resolve_slow(struct ifnet *ifp, int family, int flags, struct mbuf *m, * packet queue in the mbuf. When it exceeds nd6_maxqueuelen, * the oldest packet in the queue will be removed. */ - dropped = lltable_append_entry_queue(lle, m, V_nd6_maxqueuelen); - ICMP6STAT_ADD(icp6s_dropped, dropped); + if (m != NULL) { + size_t dropped; + + dropped = lltable_append_entry_queue(lle, m, V_nd6_maxqueuelen); + ICMP6STAT_ADD(icp6s_dropped, dropped); + } /* * If there has been no NS for the neighbor after entering the