From nobody Mon Apr 11 13:44:01 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 91ABA1A85D50; Mon, 11 Apr 2022 13:44:02 +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 4KcVSf1Gdwz4vc4; Mon, 11 Apr 2022 13:44:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649684642; 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=yNyEEBKfQfs5nEmt1U4Ry3H1aNoPvc9ggNKpHCDYk+w=; b=G/pSxm8uJU3W+awPMW/X0Y+p3CGzPpLM1ViSSzE6gmcJOEIIiPxML/yOT+tziaYu4ti5fl Rhekk6Y2+hUCH4JF8EF7my2bWDUfEp+sRV3N5n3YCt2oiAAMiFPRL0HaX9kZr8mmEhK1E+ OQgSefQBXIWI0IUIJZKIqAhyDNri6k7CKvj8ThZuRdfkL3D/bRgBAZHowrY4Hq7X7BGO4i fCBJ0d+JCcw9OcSB6bG9OVEfnYx0liwMr7jq8NlO2bGso8579UrFm0l+/beMQabsLcHYkd J7g3hQqI2IfVPnJqvDgybNerWRwGpuTpIqS5Rn4S1FMHZq7MmLPDngx8q+6iPQ== 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 E3F8724184; Mon, 11 Apr 2022 13:44:01 +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 23BDi1o8028987; Mon, 11 Apr 2022 13:44:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23BDi1dS028986; Mon, 11 Apr 2022 13:44:01 GMT (envelope-from git) Date: Mon, 11 Apr 2022 13:44:01 GMT Message-Id: <202204111344.23BDi1dS028986@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 251aee96ae67 - stable/13 - net: Fix LLE lock leaks 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 251aee96ae67b84e02ee33f36028c6d0f43b9aa2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649684642; 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=yNyEEBKfQfs5nEmt1U4Ry3H1aNoPvc9ggNKpHCDYk+w=; b=KT878iKfnsKBVy699hTbbj/1Ae2665ySgfCx//gk9idhsq0W93oeKeaIR16Tmg0aEex6WH 4MiBSp47AER+tOJAG7EECtohXUkLm+ZQ6KRf3xlrx5f+/oFC9kuOLLKdFZUqYRvdygwBmF mU5hOKx9zO4ka6TnTX9s1fgd8HgyZGpb4Ef1Rc8wC6G/OOiQR6J9Zj8NE0mWu0c2/ZynKI vaUqwEnFlkdPtvtln10eKozRSsJINSTszgrxx8qALqNk1S9dMkAAJaGs3/9Wc4uIrM6JeN YupZLPuonQcW1IySJgYyryVwL/j/joG+H154vomE++p+Qgkz7d4ff4A+k67Ssw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649684642; a=rsa-sha256; cv=none; b=W7VylrYyK/NMXwJf1KTT6GLbK0vd3Qtc8331dv9QlZxNaGBltrPivzpb0NmBwMiVKfZ4hE 4C/0FX4XkjO9ZdGeSxXuHTaei5MMVfrjegVk97RVToeLMo54dz/1ij2nYo2CpeVzKf+sOP H/rLV2+bOysULAfrQOowzYMXtgIHNj9lPs4AQLh0LLB2bIGfB74wdJTgy9BRbCtJOZ316q XaxdyWzz+ewval0rBx7UbjhixhhawIYIt4EmkY9lMuWuGtQpgYGiRf2UVZzHbUXMh1Vju6 OMoN8+mC6Luq69eT6lZdzzrRNZpBAsssbFnEMkFN4RxLO75EwtwY4t+OePrCIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=251aee96ae67b84e02ee33f36028c6d0f43b9aa2 commit 251aee96ae67b84e02ee33f36028c6d0f43b9aa2 Author: Mark Johnston AuthorDate: 2022-04-08 15:46:19 +0000 Commit: Mark Johnston CommitDate: 2022-04-11 13:43:27 +0000 net: Fix LLE lock leaks Historically, lltable_try_set_entry_addr() would release the LLE lock upon failure. After some refactoring, it no longer does so, but consumers were not adjusted accordingly. Also fix a leak that can occur if lltable_calc_llheader() fails in the ARP code, but I suspect that such a failure can only occur due to a code bug. Reviewed by: bz, melifaro Reported by: pho Fixes: 0b79b007ebfc ("[lltable] Restructure nd6 code.") Sponsored by: The FreeBSD Foundation (cherry picked from commit dd91d8448665dd31df5be7341756394293c6e36c) --- sys/netinet/if_ether.c | 8 ++++++-- sys/netinet6/nd6_nbr.c | 4 +--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 5400f35d953f..59a7c78cb03b 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1239,16 +1239,20 @@ arp_check_update_lle(struct arphdr *ah, struct in_addr isaddr, struct ifnet *ifp /* Calculate full link prepend to use in lle */ linkhdrsize = sizeof(linkhdr); if (lltable_calc_llheader(ifp, AF_INET, ar_sha(ah), linkhdr, - &linkhdrsize, &lladdr_off) != 0) + &linkhdrsize, &lladdr_off) != 0) { + LLE_WUNLOCK(la); return; + } /* Check if something has changed */ if (memcmp(la->r_linkdata, linkhdr, linkhdrsize) != 0 || (la->la_flags & LLE_VALID) == 0) { /* Try to perform LLE update */ if (lltable_try_set_entry_addr(ifp, la, linkhdr, linkhdrsize, - lladdr_off) == 0) + lladdr_off) == 0) { + LLE_WUNLOCK(la); return; + } /* Clear fast path feedback request if set */ llentry_mark_used(la); diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 0c6dd9e0361f..3a56964f8eb3 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -855,10 +855,8 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) linkhdr, &linkhdrsize, &lladdr_off) != 0) goto freeit; if (lltable_try_set_entry_addr(ifp, ln, linkhdr, - linkhdrsize, lladdr_off) == 0) { - ln = NULL; + linkhdrsize, lladdr_off) == 0) goto freeit; - } EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED); }