From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0667044DB95; Tue, 16 Jun 2026 15:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781625269; cv=none; b=J+wYp/OzdbXGjOe8wooTuacZoVH461TFmXd+OuvcvpZ10dySZ420RXXVznyO5HNZuenIAAfeJB3G7NGLnHZAuQdjRdh7eFDGNP7dibg8VBDpgXnWXqyb7tJVUs7CczL7yZlqkJDXYL5leF5/pEX02GdjzdlSZ+1W1d4qXyOfF3w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781625269; c=relaxed/simple; bh=nSsX2A/uNzS1quOIOXLrblbNzCrewrZMpfn3/y07ngQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cNtdHwc05966rlJL6jb3VlsdQH/spVpokdxEWqnAGTIvrnjGZe8IWJtayZM3/yid09ALNGtV3Ot9w3k+VYowe8vIzC/QxzMsLEBaeQ9AP+mdq46j1oEx5wUh2/pe+vH9IO3fnLuWzdHxEVziT2eU76zxLKEXgWm/wDLHmd4vYvI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zPdnuTH9; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zPdnuTH9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4C981F000E9; Tue, 16 Jun 2026 15:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781625267; bh=TXxJ6hp9LhQ9/uBDp/++P1irbNQK+I9AaOqUVOIrrJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zPdnuTH9wSjAVXm/or0lRHScmLxNDW+h2x+LyZQbkY5LcH59KRQn6dVvIPe9Eb3IJ jj9siiMhGNrEeVd4P4pWRk9zsb/K5yJN3uPQLkAl8Kgz7ZVRwouMjaO5qKJmLdb5Zi +pXASKAGG5CYEwfuIYj8rbzsuz8tHqp6TRWTVHng= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Adrian Moreno , Aaron Conole , Eelco Chaudron , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 108/325] net: openvswitch: fix possible kfree_skb of ERR_PTR Date: Tue, 16 Jun 2026 20:28:24 +0530 Message-ID: <20260616145103.070076421@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145057.827196531@linuxfoundation.org> References: <20260616145057.827196531@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adrian Moreno [ Upstream commit ee30dd2909d8b98619f4341c70ec8dc8e155ab02 ] After the patch in the "Fixes" tag, the allocation of the "reply" skb can happen either before or after locking the ovs_mutex. However, error cleanups still follow the classical reversed order, assuming "reply" is allocated before locking: it is freed after unlocking. If "reply" allocation happens after locking the mutex and it fails, "reply" is left with an ERR_PTR, and execution jumps to the correspondent cleanup stage which will try to free an invalid pointer. Fix this by setting the pointer to NULL after having saved its error value. Fixes: 893f139b9a6c ("openvswitch: Minimize ovs_flow_cmd_new|set critical sections.") Signed-off-by: Adrian Moreno Reviewed-by: Aaron Conole Acked-by: Eelco Chaudron Link: https://patch.msgid.link/20260604121946.942164-1-amorenoz@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/openvswitch/datapath.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 2304c8e3be4f70..56c744e1e14c5f 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -1316,6 +1316,7 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info) if (IS_ERR(reply)) { error = PTR_ERR(reply); + reply = NULL; goto err_unlock_ovs; } } -- 2.53.0