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 47D674779BF; Tue, 16 Jun 2026 18:54:26 +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=1781636067; cv=none; b=nzM2pz8y8+AsCaKt7V01+dxJHbS97EuoqMK3Pjj1eGC8yy4c3C9LUy+4lUi3gBrvc/S8jHFM6FXJGAd3gjJTyykddVhYaktjhWGY3Mh1He9BF4rpYrPgOXFUNVWgxAnZCOEnrI7CmypjuyZiqKtT5kKWnOXiDEQ3PrwjuZFfsX0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781636067; c=relaxed/simple; bh=LB8rf8qRCUuDASKnUxcf01FnXh2H8iwsJbMuWa3q1Mo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KMgJPmxaHMqk07/JdvG+jMWU7HgRgn68nWN5fPX9JPDG3+cxpHzV4ZzZgdgMMZvCttQvGYIiLK4DUjiVh199WcRZl4rGVh/dRqF9tiap1789kwgLYb1nJzAScGiXHxR0u9Wt9ILsj5TmiidlZ3TUWIVxQ7oO1Uz4SQXZSEusg0M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SlrndwjU; 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="SlrndwjU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45B0B1F000E9; Tue, 16 Jun 2026 18:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781636066; bh=REez0DD0fUg7sTZgI2eh7OHirS15rJ8Bv7dQ+7N6rI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SlrndwjU6yMGBohu3NCjdkjzMo7PWrctxMWIC9m9jnAzIBB6XKj18443QXukTmLkn ris0Fj/wA8GdTiivckXEU9p7Yqs/yXOTKb8IAv/+CKoT255qiGE6gXcJMhzN+KqaCE cpIKRei8FjuqS8Botg0GLmto7NhZznqxGtEPJt0c= 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 5.10 169/342] net: openvswitch: fix possible kfree_skb of ERR_PTR Date: Tue, 16 Jun 2026 20:27:45 +0530 Message-ID: <20260616145056.073706213@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145048.348037099@linuxfoundation.org> References: <20260616145048.348037099@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 5.10-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 1c69aa986633af..5fb74fbcb2f382 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -1248,6 +1248,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