From nobody Mon May 9 17:55:10 2022 X-Original-To: dev-commits-src-main@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 D20D71AD8DA0; Mon, 9 May 2022 17:55:10 +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 4KxpjV3kn2z4sjH; Mon, 9 May 2022 17:55:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652118910; 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=YygW5DUCHEm8OeVdO1M9BZoSFfcTLNn+eleYQrNd0ok=; b=ULJ/VjJYycKMt7BYHnqBVBEWKO/94usv66TcecxpLG8ATbVgKAVeBqU1wSz1foE1g/yiKH +W9LxSxEmr1vL2Sr9n5gZV6e+VYaVTLMdijixI6FdHoX01ypqicp/0o3fZWhXyon7/63v7 ArgYoyJs/rkoNs8BBkM75r761Z49KMMhD6cpIoPT/3qioBEGkVkxIEJ4WSaGbTiGmCsiT6 NBBZnFugN1VlHC2UkYABJRH3Mn/jPCH54T4+j3abID1bQIT5j+giGU9m3P4RuW1IzcE5a4 Lrk9Lzlyp7bm58W80Ie7ZA4A+UGKtN1mqlN75rp7ihzieH5WvWoJDFkWvYgk9w== 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 409A015B0C; Mon, 9 May 2022 17:55:10 +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 249HtAHo061179; Mon, 9 May 2022 17:55:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 249HtAKT061178; Mon, 9 May 2022 17:55:10 GMT (envelope-from git) Date: Mon, 9 May 2022 17:55:10 GMT Message-Id: <202205091755.249HtAKT061178@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 42f2fa9953da - main - sockets: don't call dom_dispose() on a listening socket List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 42f2fa9953da13678b30942afc84e7e9fdd7c43e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652118910; 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=YygW5DUCHEm8OeVdO1M9BZoSFfcTLNn+eleYQrNd0ok=; b=j5ADbZ6JtD11Uw/08SDl4Mrr1M6GBv0ij9WFyqMHPMtUwlRBVLoql56/2C9Qp97040hrwM OqhFMwggOgxcoiEVfagq37ENS9P8avNIyacuKlXlU231H8/xS0iRWUKCYYWT9UfyURDQUc p7lc1Mv2YtlTATHjGFzEYlgBDK92WejL302SaPVqtKaxsUnUYOD0DXAL3YxzQwAWfuC8d+ 1/9vCD2sodSlGgqYinMmt6xvj4db5q67FJIVcWd4Nx2u7jNiou8kg4SdOKfxNHGQudLGwd Wm2jjnGRmQ7GjG84dfwXprWP0z6SZH1x85WIa+0CSlrI18/bpyu2eFn5AWt56Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652118910; a=rsa-sha256; cv=none; b=Xz5kCcqCSTgP0rPmCnBq4AshwV8Mg324APewr3Ge9t46XqP46adzZx97iN2PzE3UZgyXyL r/+AUSPk6yVAq/GrNKeMnHWZtQM7tD+ygITgHgSSSSjAvwJxygSCm/imR5MaZCzC25bQLc 6V8sQTxm8FXFwlwaHsk/JzREavyBH/XU/kDgZqlhTErUGq1qjYxN3dLUIbHuhymNiAPsiN KWOOiXsvL9HsUSkS7SdbSqOd4/0Tq8DdJczqCAEHpA8GO58V/rxFqkPgpBZksArUhFOh13 2LkmJWAUwVhjUt4WkTKaL2mQu54IVXB/5ULoBp58tCe1Bh7CKcq2Mo8jIHdzrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=42f2fa9953da13678b30942afc84e7e9fdd7c43e commit 42f2fa9953da13678b30942afc84e7e9fdd7c43e Author: Gleb Smirnoff AuthorDate: 2022-05-09 17:42:57 +0000 Commit: Gleb Smirnoff CommitDate: 2022-05-09 17:42:57 +0000 sockets: don't call dom_dispose() on a listening socket sorflush() already did the right thing, so only sofree() needed a fix. Turn check into assertion in our only dom_dispose method. Reviewed by: markj Differential revision: https://reviews.freebsd.org/D35124 --- sys/kern/uipc_socket.c | 2 +- sys/kern/uipc_usrreq.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 029f7c8387ca..299610477068 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1195,7 +1195,7 @@ sofree(struct socket *so) so->so_dtor(so); VNET_SO_ASSERT(so); - if (pr->pr_flags & PR_RIGHTS) { + if ((pr->pr_flags & PR_RIGHTS) && !SOLISTENING(so)) { MPASS(pr->pr_domain->dom_dispose != NULL); (*pr->pr_domain->dom_dispose)(so); } diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 3ce7ddcd7f17..d56922c6fa3a 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -2769,12 +2769,13 @@ unp_dispose(struct socket *so) { struct unpcb *unp; + MPASS(!SOLISTENING(so)); + unp = sotounpcb(so); UNP_LINK_WLOCK(); unp->unp_gcflag |= UNPGC_IGNORE_RIGHTS; UNP_LINK_WUNLOCK(); - if (!SOLISTENING(so)) - unp_dispose_mbuf(so->so_rcv.sb_mb); + unp_dispose_mbuf(so->so_rcv.sb_mb); } static void