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 DF78B43D4E9; Tue, 16 Jun 2026 17:02:35 +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=1781629356; cv=none; b=I+V2hoaiRPIRCrlix6H9o8H5F5dtKP/v4dlkOF0TLmWZ/mV2kUIi0bYMcjq4TEM8BnRGvWJYlE6X/6aEwPkJagbtLpcR0fMm3X60xgwyHkgrNfwY9urhCsO4HWa4Yv5UToPRpe+4p7hxD2b9hjAB0EfyUF65e9Mkveho3ZOkSNQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781629356; c=relaxed/simple; bh=H7qdCuf/Mq6N0DjiC4rtfEUWQ0qJwmQJy2iFTS3ySZY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E35MsaNBu0t8T+7p3mIh8eFtlK6pMFgdsusZRQnAyPF1IWDccNwaPtmbfEHu9hIG+faS93+8H5m+ymk4X7cL1vS56peLsZxuVk6d4IPyYB6ciW+ES8j2uWnawUI1N3+sZvecCcXHNS97MjXW6RHroWQss7JgJxRsF1uuKL2y46c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=T1ympQh1; 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="T1ympQh1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E86111F00A3A; Tue, 16 Jun 2026 17:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781629355; bh=Q55sXX07a8W+V/qK5M0TMOeOGeLgK4bLuC2HcurrnGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=T1ympQh12aPFnmo6ORdmotiVh17WnonxvIBDJo7Y8qE9hOpXBfeDUmvsa7LEMreHg 5nM7t/wQt0WeVZSgGZ+AT61qCc5CtjP3YSVvCiGz4szHtl6eOBgESVtqTjEdbK6ptv 9cBXnGAr/2552x5g/mRC9y49XE0+k5x+/ZrRaf7c= 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.6 270/452] net: openvswitch: fix possible kfree_skb of ERR_PTR Date: Tue, 16 Jun 2026 20:28:17 +0530 Message-ID: <20260616145131.774026780@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145117.796205997@linuxfoundation.org> References: <20260616145117.796205997@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.6-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 7803e7548d9203..857edc53739332 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -1287,6 +1287,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