Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp655404iog; Thu, 30 Jun 2022 07:47:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u1PIWBT+43vj72/vu/f1jpuxH0CdyTdilbKPjf3HuCg5hBZ1y6OlduJUTfeOcb798qU2WN X-Received: by 2002:a17:902:f804:b0:16a:da1:1ef7 with SMTP id ix4-20020a170902f80400b0016a0da11ef7mr14833617plb.17.1656600446632; Thu, 30 Jun 2022 07:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656600446; cv=none; d=google.com; s=arc-20160816; b=CR7QUZd8iffACna+IQyA4u4PvKy6PYZE49xmtOWnbWyABjJ2s/V/8zZoGZ5vf3UE1i 26/ijhWGk8NV46iqSq1HWtPlPm/3+K6pSeK1Uwz9H0jUt+eHVjxRSqCrKj4tQJW42v/T bN3IXgsuCpkelsT5s2y0Ok4/Tb52BFIllR8UidU4V2sdGL+TI9/V2XXZKeeWbRgIGLUR NYCGE2Eee8B+iaJZ0zLRVBSi1JvBAPayG/v6uRujWBOS43DUc5tmwos5EfIdezhEfR+2 Fjet90Q4C9Zt3v1gH0sB4XJAyCEl3bPy1M52HRnV3qbYlVu94gPcC8S+aYQ1p/avbKNX tYWg== 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=hYXMPriA8KN/KMP1ccWyM+6VBEJX2VXJn/fxMy1/l5Y=; b=Hk9zymFwDyxnCZXMTY4Nbd0wig1RYOvATcir0mP0vzxGCHUBFvSVO9JOY3JcqeRRJQ /8Jq8f5YP64jymvv9OQIpqYR7D8IG+8TFAb3T+txVzVTHGIfhJ+/Fmcva6PVYJLgWHbw WaKbcPePGjawb6GSpAqg7V8vnPEPyEflaAtFlZERQnlE+jIS47j1vqcAfL54LLXsaYv/ iwsfZ7Sm97VLk4cE2QAPInC6cY+Fz4GTRVRr5o9rctNc3S92UgeyWZzNsXbzIdrvlXA/ GgI+JxkXyd4riCM3rggqOEWPSydaBxoogWF5WUqGXXfHRnY6dADR3R1YWJ2WdG3qUtl5 wimA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bo7bD4vq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f68-20020a636a47000000b0040c834e2cdbsi24011600pgc.746.2022.06.30.07.47.14; Thu, 30 Jun 2022 07:47:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bo7bD4vq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235743AbiF3ODJ (ORCPT + 99 others); Thu, 30 Jun 2022 10:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236295AbiF3OBk (ORCPT ); Thu, 30 Jun 2022 10:01:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C9C844A2C; Thu, 30 Jun 2022 06:52:46 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 2B0466204B; Thu, 30 Jun 2022 13:52:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3741FC34115; Thu, 30 Jun 2022 13:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656597163; bh=3idDa8ATqAbwQApJrzgq1aI3YN9/sb++FYb3ppCmv3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bo7bD4vq2zF/IK/txFbyz4gAXgK3Ri52mUaeCMjGAc39xOdDKJeIPeUFiF7Cbwg+x MfelusT0ZDPSjaAGXRD85vblQGLisF5eSyVXK1v6Sfhs+dxb7AVoRBnCfKSu7uZoAp HtyJThkByAx7MzbbyNmPy0uPC41xh0vMwo9UR8sk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Thorsten Glaser , Diederik de Haas Subject: [PATCH 4.19 48/49] net/sched: move NULL ptr check to qdisc_put() too Date: Thu, 30 Jun 2022 15:47:01 +0200 Message-Id: <20220630133235.289157437@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220630133233.910803744@linuxfoundation.org> References: <20220630133233.910803744@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Diederik de Haas In commit 92833e8b5db6c209e9311ac8c6a44d3bf1856659 titled "net: sched: rename qdisc_destroy() to qdisc_put()" part of the functionality of qdisc_destroy() was moved into a (for linux-4.19.y) new function qdisk_put(), and the previous calls to qdisc_destroy() were changed to qdisk_put(). This made it similar to f.e. 5.10.y and current master. There was one part of qdisc_destroy() not moved over to qdisc_put() and that was the check for a NULL pointer, causing oopses. (See upstream commit: 6efb971ba8edfbd80b666f29de12882852f095ae) This patch fixes that. Fixes: 92833e8b5db6c209e9311ac8c6a44d3bf1856659 Reported-by: Thorsten Glaser Link: https://bugs.debian.org/1013299 Signed-off-by: Diederik de Haas Signed-off-by: Greg Kroah-Hartman --- net/sched/sch_generic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -970,8 +970,6 @@ static void qdisc_destroy(struct Qdisc * const struct Qdisc_ops *ops; struct sk_buff *skb, *tmp; - if (!qdisc) - return; ops = qdisc->ops; #ifdef CONFIG_NET_SCHED @@ -1003,6 +1001,9 @@ static void qdisc_destroy(struct Qdisc * void qdisc_put(struct Qdisc *qdisc) { + if (!qdisc) + return; + if (qdisc->flags & TCQ_F_BUILTIN || !refcount_dec_and_test(&qdisc->refcnt)) return;