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 273DB4508E4; Tue, 16 Jun 2026 16:21:32 +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=1781626893; cv=none; b=o7TVLzcqc5p+7L1nfGFAPel3ZsZINOrmGgpRUvfwgpoITcXbUi/jmgZh+OJkiAlKHUd1Z6Zn69JEiYtC0lz/YmCLD5EUzpS1JCW1XGD6wdW7vMG6RqWFyQkjyjvKIwWJMhvSa1BWrVcKeWoTK4ubtIWezhyB8Rly+JV+uiafsAM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781626893; c=relaxed/simple; bh=rBXJYCot6FoKia82Egpnd67DNt+M30BrM6h4ZpWBLX4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NmqdCYpNl9jq27j+b+d761hbMbrmyPtiC7caG/S6qO+IaJGMh8UA+ioY9cKDGirVcGP346WvOqr8HQ0I9eDULCW2vb4xsHrGPASYuBmatJZQlHLnePeMIYi48P0BKuBpmjB4qOFrRTPewB2JWIexssnnI86ToSZC7nsj+SKwCPI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=F/LioCK5; 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="F/LioCK5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37CD91F000E9; Tue, 16 Jun 2026 16:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781626892; bh=jsO4ih3FxI4sBmXnlCqrFa6AYYuroWck9TPwduGfhz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=F/LioCK5H99Vx4Nt8drjkGINApUGa1ghBkyr8YsBSslL31OfLNAC3bkaBcS/1hWWn Qu5+hdEqyQiawXlAMyfHLQuitulHRTLsjjJow4s+qvspjAGfd2Jtq2YckjBrr9mhyw MVZ5PlrBaQ4o8BebPkI3oQZ5zUh6cC1mNy+1tXz8= 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.12 089/261] net: openvswitch: fix possible kfree_skb of ERR_PTR Date: Tue, 16 Jun 2026 20:28:47 +0530 Message-ID: <20260616145049.160190669@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145044.869532709@linuxfoundation.org> References: <20260616145044.869532709@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.12-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 607b5ca70ea547..260d1af64afc90 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -1286,6 +1286,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