From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 537A4C4332F for ; Mon, 14 Nov 2022 13:05:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237788AbiKNNFd (ORCPT ); Mon, 14 Nov 2022 08:05:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237795AbiKNNF0 (ORCPT ); Mon, 14 Nov 2022 08:05:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 121B92A707 for ; Mon, 14 Nov 2022 05:05:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C13BEB80EB8 for ; Mon, 14 Nov 2022 13:05:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F0EDC433D6; Mon, 14 Nov 2022 13:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1668431122; bh=34We7NeJxOWKK6/o/I0v9/bqmfoYv7XgHgrCfkc5CSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wM5gh9VaxB09vqQkYIaoG7VXSAg00Lcr3higYjt8hBUFI8dlm6/tikSFBEt0Phhbm hqtj4CzTfCtl6rKndKB1OBDBtFIDkIqwPOu8atrSXW7HsTKPKYbShHtrR8/3jcCkVU N17/WAWFCmKeZRT/XfldfnXtTfOWeDQg/nkbbS44= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ziyang Xuan , Florian Westphal , Sasha Levin Subject: [PATCH 6.0 079/190] netfilter: nfnetlink: fix potential dead lock in nfnetlink_rcv_msg() Date: Mon, 14 Nov 2022 13:45:03 +0100 Message-Id: <20221114124502.135541893@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114124458.806324402@linuxfoundation.org> References: <20221114124458.806324402@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ziyang Xuan [ Upstream commit 03832a32bf8ff0a8305d94ddd3979835a807248f ] When type is NFNL_CB_MUTEX and -EAGAIN error occur in nfnetlink_rcv_msg(), it does not execute nfnl_unlock(). That would trigger potential dead lock. Fixes: 50f2db9e368f ("netfilter: nfnetlink: consolidate callback types") Signed-off-by: Ziyang Xuan Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin --- net/netfilter/nfnetlink.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 9c44518cb70f..6d18fb346868 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c @@ -294,6 +294,7 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, nfnl_lock(subsys_id); if (nfnl_dereference_protected(subsys_id) != ss || nfnetlink_find_client(type, ss) != nc) { + nfnl_unlock(subsys_id); err = -EAGAIN; break; } -- 2.35.1