From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0051.outbound.protection.outlook.com [104.47.2.51]) by dpdk.org (Postfix) with ESMTP id 9E55D6904 for ; Thu, 4 Oct 2018 23:23:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jMzNKoSGgKcaOd9QlJ2A4BQK8IRTm0hkt/lV52Lv4qc=; b=Wbd7WM5kEavLX4wcYePffGfPck2ciiO7vOr/Kc5TLoBOGnTWTkZkxNfXBGeoncbTzVHA7ZY8KoxF02c7oSTxtrhuTNvNiaqwbjKQ4ibPFEvEFK0RdfuzV+88b6XzHmM9ih2uQ2Pkut22q63O2IikXL+rH1j4oazVURo9KW/TzTM= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3961.eurprd05.prod.outlook.com (52.134.70.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.23; Thu, 4 Oct 2018 21:23:58 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1185.024; Thu, 4 Oct 2018 21:23:58 +0000 From: Yongseok Koh To: Qiang Zhou CC: "525930045@qq.com" <525930045@qq.com>, "stable@dpdk.org" Thread-Topic: [dpdk-stable] [PATCH] vhost: fix crash on unregistering in client mode Thread-Index: AQHUReQaNiuJPVzzVEShk7bNLfhW/KUPxVaA Date: Thu, 4 Oct 2018 21:23:57 +0000 Message-ID: References: <20180906131805.95151-1-zhouqiang2633@gmail.com> In-Reply-To: <20180906131805.95151-1-zhouqiang2633@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-originating-ip: [69.181.245.183] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3961; 6:T0oZiH6k9Kbmh9tdZR//BDd311x1cJcZbOJVsUB1gzq9PLl0GapOMjwjhWIOEMj/9iKn0lSmKZDE1s/zSfh1JKRgc4EGl0LyilvW1C6UdbNC5gK6snCK3aiRbAMr6mJHiqWIcixn+rtjMxVUG6eVaWi0iDimSTPPeFbsPVpsMqLv/eGlBZcSFa5x66hYDR6lQMXWK+fsXp0Dl44jTqD94vdPnNGTvT4gFuRZIpCCFDaQD5BCttMWPDEWP4T4wwmOodjX5fZo3gLlt9kbhzRrMKk/5PK7XvFr1y9ruwAfK1gnHLy0S5pgzy8RvIJPdCoa4Uto7LKQ0Q+6I6eBlHtQ0XTYsxCvOv72FjDUB3Z4k1A/MIe7cLr8YKqZpqMlYyf74qr74dFxJYfhirFMKPGGELmkNe+CzyI02zMaS8BIvJghbqk1EOiJfY5GYW/s2eHI3hOu00JZNbMd6iNx9Z3IAA==; 5:8qZSQk2fhNeievol7uK1fcfdy/IWh9KOI2uQ18B5ym+1exKYHh3saGySBy0lM4GC1+8QQls/F2adRvwXfaqAXpnz3M2n/gERCjRWpu3ZUK4+WPmW0cr9RGyGQbMtceFXgfXOOdXlSy21N8TGfpaWCA6KpWehIXmkdaBW6UY6ceA=; 7:1Pjq3jaq8a1lUC0SYFK/IRHSeWCdIesNirGW1sBbrMlsx1PGFird7yUAHTKNkS9W/WIf4SgfGA3k8Xw2g6aG4SzpO5exc9MUz5W5hZu2FVOKgNt01OXNIz65nlupNElzwP5bcRYnSSOxNgOaBk7N42FAq6YfzMxpywny3QUBuWQHAFrP8t6V77qwuFaClSDviplS5lirdUB5jK0ngiTo/zQgBc2epJFWJZDoFUBsKYaPAHtkaly2UoCWpWQ8LQ47 x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: c7f98c88-590a-454c-2733-08d62a3fb239 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3961; x-ms-traffictypediagnostic: DB3PR0502MB3961: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(85827821059158); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(201708071742011)(7699051); SRVR:DB3PR0502MB3961; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3961; x-forefront-prvs: 0815F8251E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(366004)(136003)(346002)(396003)(189003)(199004)(39060400002)(6246003)(6306002)(6512007)(83716004)(71190400001)(53936002)(229853002)(5660300001)(106356001)(105586002)(6436002)(186003)(6486002)(71200400001)(4326008)(966005)(256004)(102836004)(25786009)(14444005)(26005)(478600001)(6916009)(97736004)(14454004)(316002)(86362001)(5250100002)(3846002)(305945005)(54906003)(2616005)(6116002)(11346002)(7736002)(476003)(81166006)(36756003)(81156014)(486006)(33656002)(66066001)(8936002)(2906002)(6506007)(76176011)(53546011)(446003)(82746002)(99286004)(1411001)(68736007)(2900100001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3961; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: AvkF/c5SNuMIUXaa0sMOETXJA9/ONTW7jXN9YmPVp82Ns5u4KtSFJvYH+MTdgpGTkMomIs1Ncs1+safIuY5UncrwKwkX19HL3EUzPl9RSBGsTXSAUtWG4bH3zfWUK4J0pj7jA+9Qua1Cxw+9sZ33G2m1PBdY4YL7mwhmPodzgWr0PvGmPZhZ8H5mfF/a8wNLrOgbsZOuVvXyCcnVu3/360SfpBt36V9TT03n2Mshswvub/IieVr+0Yq1tPiZspwnIKw8YjDhbWaV2xfESzu6ZEPSoLd7ydbNYNgxeI4q5X5wWirofV5V5apvkvtLliCjmjwIcp+qp10gPSHeSudnCb8Fly4n/5A7Rpu13NrJOE8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <987D53993C601048A66E421B68AB17E2@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7f98c88-590a-454c-2733-08d62a3fb239 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Oct 2018 21:23:57.9569 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3961 Subject: Re: [dpdk-stable] [PATCH] vhost: fix crash on unregistering in client mode X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Oct 2018 21:23:59 -0000 > On Sep 6, 2018, at 6:18 AM, Qiang Zhou wrote: >=20 > when rte_vhost_driver_unregister delete the connection fd, > the fd lock will prevent the vsocket to be freed. But when vhost_user_msg= _handler > return error, it will delete vsocket conn_list. And then the fd lock will= become > invalid. So the vsocket will be freed in rte_vhost_drivere_unregister and= the > vhost_user_read_cb will reconnect. >=20 > To fix this: > move delete vsocket conn after reconnect I can't find this patch. Please use standard "Fixes:" tag. E.g., Fixes: 9c19c83bac54 ("app/testpmd: fix missing jump action in flow action"= ) > Cc: stable@dpdk.org Which stable branch are you targeting? We recommend you to send it with an appropriate prefix. E.g., git send-email --subject-prefix=3D'PATCH 16.11' ... Please refer to "5.11.1. Backporting patches for Stable Releases" in the contribution guideline [1] [1] https://doc.dpdk.org/guides/contributing/patches.html Thanks, Yongseok > Signed-off-by: Qiang Zhou > --- > lib/librte_vhost/socket.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) >=20 > diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c > index d63031747..43da1c51b 100644 > --- a/lib/librte_vhost/socket.c > +++ b/lib/librte_vhost/socket.c > @@ -293,16 +293,16 @@ vhost_user_read_cb(int connfd, void *dat, int *remo= ve) > if (vsocket->notify_ops->destroy_connection) > vsocket->notify_ops->destroy_connection(conn->vid); >=20 > + if (vsocket->reconnect) { > + create_unix_socket(vsocket); > + vhost_user_start_client(vsocket); > + } > + > pthread_mutex_lock(&vsocket->conn_mutex); > TAILQ_REMOVE(&vsocket->conn_list, conn, next); > pthread_mutex_unlock(&vsocket->conn_mutex); >=20 > free(conn); > - > - if (vsocket->reconnect) { > - create_unix_socket(vsocket); > - vhost_user_start_client(vsocket); > - } > } > } >=20 > --=20 > 2.14.3 (Apple Git-98) >=20