Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3508651pxb; Tue, 19 Apr 2022 04:18:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVv1Z9wXBHIMNdDwLFqBBHkxNRmWSFzbLE1lllzkKVjDKLRJlfo/yIaUn4vX4ty27d6c5e X-Received: by 2002:a05:6a00:cd0:b0:50a:74db:a85a with SMTP id b16-20020a056a000cd000b0050a74dba85amr10334008pfv.67.1650367125683; Tue, 19 Apr 2022 04:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650367125; cv=none; d=google.com; s=arc-20160816; b=tlxrkVOTWVvXqrR/hYWLz18z8vaqRXzeGJ9nWQ2EigCoZnWdr8eQKjA/UJv5zjUNsg 09ci30IxiYmTA0kEse/nzYIEr1RQUTy2DPeQpLP65nYPxddK09gGvDv5071GYCgLGn1s dywGMIIvy9yvUMnPRc7l33SvvIxLQMBGB8FRIhzPYTM/zczaNfxJba7avyVpgedDT6gJ ruZcEte0ExEEJm9Hi3zwdun1Ln4WzP6oNJyyRIlV55u1cgFELa6g0mLxjr/Xx2rmugMn ia2DVZmRQ9fW0RItBs6Mn4gFCOf5JZmApYKJgZMkaQVWM4fR2fVBXCybKlN2XaFFpsVX NCgQ== 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=j+3VRTltJIbAHqnbJ+TPBQsCpHkIe8E4sq1AYookvQo=; b=IylTE822Gs4mTkAZP8wvjZiIuSdSER9rSLqihLn/ZZ1oMNCXpXFA8XDzTNQicBYcad dzjAX01DGg+m5cV8i6iouEZbcXon8jwat46GfjaJi7Cw1Xl2y3xvZBepWH2np0LjQJEl mDQzhTEDNIQu1xcMdDRfWqPORji4UQkcEDX6vL9LhEdq9o656O/+rIawD/ylqILsVwLV Xj06IGvkLSaRYWzDsnwR+Lg8/BOQGLikVy15KKuS6l4cBLRQnmTwN3DmdSVW3IA35IWs hCJrVVu7/r07HarQuSBVnS2gRp3PJoogMGkvxYZhuLPdbftBlX9LK3TwTQwRYhQodK1y QN7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wSKW66Sl; 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 r14-20020a17090a940e00b001cf9b0e74a6si1709493pjo.175.2022.04.19.04.18.31; Tue, 19 Apr 2022 04:18:45 -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=wSKW66Sl; 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 S240259AbiDRNep (ORCPT + 99 others); Mon, 18 Apr 2022 09:34:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242275AbiDRNIz (ORCPT ); Mon, 18 Apr 2022 09:08:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7784A3525B; Mon, 18 Apr 2022 05:48:26 -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 076106128A; Mon, 18 Apr 2022 12:48:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3DC3C385A7; Mon, 18 Apr 2022 12:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286104; bh=eKsyNOgDgUbv/IxsbppHvlC2vjtNL19xnUQ72S2luC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wSKW66Sl02sksyfDJ8are+diEnkMgQVugNkrKpXeX3XktmnDleAhwOqf7doueEEsY 5nUDwjZvjOCUOjGtjFbU505GDnK/wwto1ZghA95pzAJR4asEQujIY4lmOMAmXqcUap IRxv6p89417PR+yCQ2yvS5O9lqSGOzoe7SGUPPc4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yajun Deng , "David S. Miller" , Pavel Machek Subject: [PATCH 4.14 003/284] netdevice: add the case if dev is NULL Date: Mon, 18 Apr 2022 14:09:44 +0200 Message-Id: <20220418121210.791317858@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@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.7 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: Yajun Deng commit b37a466837393af72fe8bcb8f1436410f3f173f3 upstream. Add the case if dev is NULL in dev_{put, hold}, so the caller doesn't need to care whether dev is NULL or not. Signed-off-by: Yajun Deng Signed-off-by: David S. Miller Cc: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- include/linux/netdevice.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -3378,7 +3378,8 @@ void netdev_run_todo(void); */ static inline void dev_put(struct net_device *dev) { - this_cpu_dec(*dev->pcpu_refcnt); + if (dev) + this_cpu_dec(*dev->pcpu_refcnt); } /** @@ -3389,7 +3390,8 @@ static inline void dev_put(struct net_de */ static inline void dev_hold(struct net_device *dev) { - this_cpu_inc(*dev->pcpu_refcnt); + if (dev) + this_cpu_inc(*dev->pcpu_refcnt); } /* Carrier loss detection, dial on demand. The functions netif_carrier_on