From patchwork Mon Oct 23 09:27:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1853599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XZ8jtjcx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SDVGh0Fw1z202k for ; Mon, 23 Oct 2023 20:27:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id AF1B260DC2; Mon, 23 Oct 2023 09:27:52 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org AF1B260DC2 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XZ8jtjcx X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gs4erkabRJT9; Mon, 23 Oct 2023 09:27:51 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id D81FA60B3D; Mon, 23 Oct 2023 09:27:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D81FA60B3D Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 93264C0039; Mon, 23 Oct 2023 09:27:50 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 034C9C0032 for ; Mon, 23 Oct 2023 09:27:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C4ADD41480 for ; Mon, 23 Oct 2023 09:27:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C4ADD41480 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XZ8jtjcx X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MbeIT_vZky4K for ; Mon, 23 Oct 2023 09:27:48 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id E576A40B5E for ; Mon, 23 Oct 2023 09:27:47 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E576A40B5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698053266; 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=0+rrPVr04vPnZ+0dInmmff8FWJzuY633q88j7forakE=; b=XZ8jtjcxK/ug3g8LRXFENxZWlo2ehVi2ejFYnEfEAAxxrfRZdyOoUTHDWRAmp/2E30fNeX zT14K0gqhsze4e+oyENdr/w/T6VKHSNiOZyCRDSHR628mHib6LRzWOK/2BX9ay0xMOHN08 mMQx2XsCdPXtCi7cjRbqPVNqLNx+3TQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-78-Ban3bTI4M5K6-_oY9wjBtA-1; Mon, 23 Oct 2023 05:27:40 -0400 X-MC-Unique: Ban3bTI4M5K6-_oY9wjBtA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 335E410201F9 for ; Mon, 23 Oct 2023 09:27:40 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.ntdv.lab.eng.bos.redhat.com [10.19.188.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19AE5492BFD; Mon, 23 Oct 2023 09:27:40 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Mon, 23 Oct 2023 11:27:39 +0200 Message-Id: <20231023092739.3861183-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] ovn-ic: fix potential segmentation violation when ts is deleted X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Xavier Simonart Acked-by: Mark Michelson Acked-by: Ales Musil --- ic/ovn-ic.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index e2023c2ba..eec466ec4 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -1630,13 +1630,18 @@ collect_lr_routes(struct ic_context *ctx, const struct icnbrec_transit_switch *key; struct hmap *routes_ad; + const struct icnbrec_transit_switch *t_sw; for (int i = 0; i < ic_lr->n_isb_pbs; i++) { isb_pb = ic_lr->isb_pbs[i]; key = icnbrec_transit_switch_index_init_row( ctx->icnbrec_transit_switch_by_name); icnbrec_transit_switch_index_set_name(key, isb_pb->transit_switch); - ts_name = icnbrec_transit_switch_index_find( - ctx->icnbrec_transit_switch_by_name, key)->name; + t_sw = icnbrec_transit_switch_index_find( + ctx->icnbrec_transit_switch_by_name, key); + if (!t_sw) { + continue; + } + ts_name = t_sw->name; icnbrec_transit_switch_index_destroy_row(key); routes_ad = shash_find_data(routes_ad_by_ts, ts_name); if (!routes_ad) {