Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1643706pxy; Mon, 2 Aug 2021 06:58:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGyaGqb5CRYnnEk5Qz7n++g72lwYYCZlQya34XQ2YFP65KLoXiN9ovaPW4rIG9yJ8xP69r X-Received: by 2002:a05:6e02:1bc1:: with SMTP id x1mr1637281ilv.33.1627912703836; Mon, 02 Aug 2021 06:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627912703; cv=none; d=google.com; s=arc-20160816; b=CkN+eLodh3M4cd4fqrjCZU2MPV/rYN5tX/GdOkBDaBhOMdCt5PEBtwCtT1eDOQsJUX K5GuRpwq50TyqnqD1/XIEvM70/Qy6aWH7D8zCaK/lFN2mvXpZC/zjE6xnwdgvs+AYal/ PBtgLJ9pTaGBfqEYviZAsZ3bFkZFNP/cbDJDgHuH4do9mF4pvR5z+vBvKaCcYvOIsw3/ rukgPT9zDl/diugV+f2re24W7qlH2K6qfK1GQqalm15AM4rIwVutnmKhaiFL5KUjE3z0 S7nKG1fU5i8wpwyve5RA9FfVm4ReAQ0s28V940OT5Ohb6S2FZgbPURPZjmXVsCebah3W 5Azg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j7ojQIjuHgYhrhKpAYjRD1DFYfHtvqSJxo7tx1C3p1Y=; b=MkHxXa8H2zR7N7RQ5FzPTG49ScmGM3zLQgRePRd+iEO+YXblquf83FQsFzDnwKfN/r 0bVRh5n2DO/ptaqtiL6OEpxmMMnf3HfXF/xkbRrllf7KEexKd1XQAhtQKA/MK2bYvj8i GNyiKck1fOqIE7sp+/YItA5o6lUWDHjrfggy5IHXRGF2e4NMnKRqV+1iY/K5zOaeyJvq bcINZWFh0Odjfmj/9Ca1Venbgvw3AOe8vKJelOku1V4F6eAoJZGV1Y4NZxt/6T/UiIMb WhPhxUlg4xyEIqsruM5QzBNuIak2lU2IGV415lWd3tu4rir+dy1cPishM0u2kjBtsy6L UEpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X8aY7dTu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si12025808ili.154.2021.08.02.06.58.12; Mon, 02 Aug 2021 06:58:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X8aY7dTu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234114AbhHBN43 (ORCPT + 99 others); Mon, 2 Aug 2021 09:56:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:33536 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234998AbhHBNux (ORCPT ); Mon, 2 Aug 2021 09:50:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 687C16112D; Mon, 2 Aug 2021 13:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627912236; bh=rnZkppms87SENbqQ0YwaRx8DDxeQ3FjXlqmpA+j/hmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X8aY7dTu1r3d7NDYZMbdGS9bq2PJtQyEORHLKxIBbLqp5lbgPMdFvAxR/sFBuacoO S64/rQoYFoRKCz3G6dRIZOPuTABlYwyzr6kRQVDTO6rIq707nwH9D4AIqt0+Xz7aXF +x02auAklaEjlmp7uA3F6bQzbcicOcOWRjJ6Ak1M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vlad Buslov , Jamal Hadi Salim , Jiri Pirko , Cong Wang , "David S. Miller" , Sasha Levin , syzbot+b47bc4f247856fb4d9e1@syzkaller.appspotmail.com Subject: [PATCH 5.4 01/40] net_sched: check error pointer in tcf_dump_walker() Date: Mon, 2 Aug 2021 15:44:41 +0200 Message-Id: <20210802134335.454274504@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210802134335.408294521@linuxfoundation.org> References: <20210802134335.408294521@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cong Wang [ Upstream commit 580e4273d7a883ececfefa692c1f96bdbacb99b5 ] Although we take RTNL on dump path, it is possible to skip RTNL on insertion path. So the following race condition is possible: rtnl_lock() // no rtnl lock mutex_lock(&idrinfo->lock); // insert ERR_PTR(-EBUSY) mutex_unlock(&idrinfo->lock); tc_dump_action() rtnl_unlock() So we have to skip those temporary -EBUSY entries on dump path too. Reported-and-tested-by: syzbot+b47bc4f247856fb4d9e1@syzkaller.appspotmail.com Fixes: 0fedc63fadf0 ("net_sched: commit action insertions together") Cc: Vlad Buslov Cc: Jamal Hadi Salim Cc: Jiri Pirko Signed-off-by: Cong Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sched/act_api.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -231,6 +231,8 @@ static int tcf_dump_walker(struct tcf_id index++; if (index < s_i) continue; + if (IS_ERR(p)) + continue; if (jiffy_since && time_after(jiffy_since,