Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5918101yba; Wed, 1 May 2019 02:28:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKxJg/XcbID85t56FhjQVSWl0iLWrvO3FDhvQt/lxjdHsnwpnZUziVYDtZoKKQhRL7Ni1I X-Received: by 2002:aa7:80c6:: with SMTP id a6mr13201362pfn.114.1556702936167; Wed, 01 May 2019 02:28:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556702936; cv=none; d=google.com; s=arc-20160816; b=VSeKmDO5+OholCND9fMllVlX4T5ab9WD6+V0QFtdH3vSzuErv3k//LFIOJ+edX9Dtd qDz8MG7Dwclw0obBMB2ECIShTnt7gHy3G2uDp5NTEl3rY/aY7cVFVxTEMGBI6AahrcBK OWNC7v/fcB2JhV4jD4HqvbG+495Qyz0f7Ga1jWO52cTlr3K0IZLBohXazd8KZHA7CpAB PiEAMjxQU2VivJpPvsGwNIebkmnOUxAZGjLwALT4SdFSJqjbjLE9aKovwKkkoQlzWiSa KWtweCb621PY+kz0pFgXYV6/pK2u+nOYweFme198aNbp6JcQMhawR4idzhLYjBkczEji RjgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=XqKy8I+a4T0E223MovLI7JFFmULW34ElM/2ZaJcNK4s=; b=qrvkefq2Rfc7kxNJiiluMId0FZgssFhcxOe+Zrtso9q5wXZRojYdYztKBDmgeze6Jq 3gC8zpPyQT4SfOAIta5j0tZwuslXejNQYev6bWJ9iUfz7wvrgukwaJpfVkvWlz1Z3zyb Sum7FDJ8nAvVd1nmknCEF3BfLyu7EZjeY+rf7lKL8IPHMzW5L+l7grrtwGvWpugySPHI JusEuPf6LpktjsGGbi0AOKK27Cgw8FQirUoIiAWyUtuNb3rrbO26iduNBjFngKr7yMlS 3efnhOmWsdguQu/+DBdQ0Bb++YWCA91siFPYJnb30nwzXCmYOysGznn+FWQVEhmXnwq7 UR9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a23si39870432pls.188.2019.05.01.02.28.40; Wed, 01 May 2019 02:28:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725959AbfEAJ1u (ORCPT + 99 others); Wed, 1 May 2019 05:27:50 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37882 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfEAJ1u (ORCPT ); Wed, 1 May 2019 05:27:50 -0400 Received: by mail-lj1-f193.google.com with SMTP id b12so13884457lji.4 for ; Wed, 01 May 2019 02:27:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XqKy8I+a4T0E223MovLI7JFFmULW34ElM/2ZaJcNK4s=; b=LYhMI5vLpRHz68NOMUWcxkGWSAGJEWLFrgDotSkbjv/kmqM4jLoPPgE5OTaXAwI1Rq cCXHS0qPZZKvQNBZw9FdEx4CuUf6tvi7iOyKfHbqjRDmZfdVkJC1vE1Kwo2yPMUPCKg5 G1Z7O8+fECsA64MO2vdz01Tim6IbuTn4aqimrpDAaRv9rP9fIB5NRXoaivaFs13PP3zy T4LYI7xkVQ6TuhMhBAlxFmwZITrhSpZZYt5Kwu91n7ob0t/9m5kZQTjgZ5D50hSiDVXj kTVjHVZDbwqr+0H6RSEauq3PVQ0PqS2sfH+MSwb0fq+RwnPtLNLFPz6YDv40XMNzHhMy 8KBg== X-Gm-Message-State: APjAAAWZhZu7H9bzWMXTXucKfiplqnh1NAfXtdLm7ypjXuiXXAzETxTP kxnq9mnhTTiOh+QsgwdzMUvsuTf6spYorYlyAppwjg== X-Received: by 2002:a2e:9f53:: with SMTP id v19mr6467840ljk.0.1556702868264; Wed, 01 May 2019 02:27:48 -0700 (PDT) MIME-Version: 1.0 References: <20190429173805.4455-1-mcroce@redhat.com> In-Reply-To: From: Matteo Croce Date: Wed, 1 May 2019 11:27:12 +0200 Message-ID: Subject: Re: [PATCH net] cls_matchall: avoid panic when receiving a packet before filter set To: Cong Wang , Vlad Buslov Cc: Linux Kernel Network Developers , LKML , Jamal Hadi Salim , Jiri Pirko , "David S. Miller" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 30, 2019 at 11:25 PM Cong Wang wrote: > > On Mon, Apr 29, 2019 at 10:38 AM Matteo Croce wrote: > > > > When a matchall classifier is added, there is a small time interval in > > which tp->root is NULL. If we receive a packet in this small time slice > > a NULL pointer dereference will happen, leading to a kernel panic: > > Hmm, why not just check tp->root against NULL in mall_classify()? > > Also, which is the offending commit here? Please add a Fixes: tag. > > Thanks. Hi, I just want to avoid an extra check which would be made for every packet. Probably the benefit over a check is negligible, but it's still a per-packet thing. If you prefer a simple check, I can make a v2 that way. For the fixes tag, I didn't put it as I'm not really sure about the offending commit. I guess it's the following, what do you think? commit ed76f5edccc98fa66f2337f0b3b255d6e1a568b7 Author: Vlad Buslov Date: Mon Feb 11 10:55:38 2019 +0200 net: sched: protect filter_chain list with filter_chain_lock mutex -- Matteo Croce per aspera ad upstream