Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1334490pxp; Sun, 20 Mar 2022 13:29:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMdY3Sck9cl7sgaGghn9CNY5mmXQm0tuRKwBBzi4JUf3QwyC6RcE8hXyoInq2KRMrY3wb6 X-Received: by 2002:a17:906:4ad0:b0:6e0:12aa:a911 with SMTP id u16-20020a1709064ad000b006e012aaa911mr1234013ejt.455.1647808168349; Sun, 20 Mar 2022 13:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647808168; cv=none; d=google.com; s=arc-20160816; b=R0+uuWqdgN0FiuZJxT68VU742KS1DEIEJ3QGnCaB/MnMYSIr1C47Vw9pqu2nLAZOFy GsYQmNnXIHUa2wUr+UZXxME5Tt/WKemYRzEsHAxdlBqmc4+vLkGZb/EblZx+idByPRZl 7ppkUcguPPIBhsU7BqSulHAOCG67O3FV8xp6ZjT8r52DDW30ERQGfcOQ9KHu1QI7+WLl wtgw3DBMfPyIzRdM1Eukj+xAXTvnq9Qs7UOpE8sDZTsARkUd9VPM+L0KQJHeWTCXdK2X 4l8T7ToiSrN0DFSigNWBEaD+0dIKrJy1XX/CjUu8KURNu7Q5vweLwH7ZFSrQLzbZTSJD 9jtA== 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 :message-id:date:subject:cc:to:from; bh=I4L2jxlUK14Wdp6IbKALa/ArK9uhKwErys897vtY6lI=; b=DLPj6pU0CgRrkBfVOcU2htmqHY18/jQd5aXrZXMgp+JagXe7WL1gdwrZqKZtHbS8mg DNrbBuzCJ1XLmt4ZX/asYxYUB9fJHrlaIrgFGudf8pt4Rz5/GrlmLj8fF2x+2QX46/LV jh5lXVRRNUNAbXVNkVqtIYRLiY5vrs3NU70p+ABkTT2teq0UAp+i5uHnxgoMBXfMTzRO cWZre+pwWC4bWc8sIfExW6XHzaXZKtQ2ROi7K2P75Z7rmPq4I28AzKTtPyDbNUHhmjzZ llq/6LJ+PQNDDtnnmKQ79sJyvRtLBPBXAvnusej5a1ITAGco2mwlCSlptyEmNCxnbJLl 3DPA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a1709064c4a00b006df76385d4fsi5419210ejw.495.2022.03.20.13.28.39; Sun, 20 Mar 2022 13:29:28 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242590AbiCSJfn (ORCPT + 99 others); Sat, 19 Mar 2022 05:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234179AbiCSJfl (ORCPT ); Sat, 19 Mar 2022 05:35:41 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31ED270861; Sat, 19 Mar 2022 02:34:20 -0700 (PDT) Received: from canpemm500006.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KLFzN3GGqzfYmp; Sat, 19 Mar 2022 17:32:48 +0800 (CST) Received: from localhost.localdomain (10.175.104.82) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sat, 19 Mar 2022 17:34:18 +0800 From: Ziyang Xuan To: , , , CC: , , Subject: [PATCH net-next v3 0/3] net: ipvlan: fix potential UAF problem for phy_dev Date: Sat, 19 Mar 2022 17:52:00 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.82] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 There is a known scenario can trigger UAF problem for lower netdevice as following: Someone module puts the NETDEV_UNREGISTER event handler to a work, and lower netdevice is accessed in the work handler. But when the work is excuted, lower netdevice has been destroyed because upper netdevice did not get reference to lower netdevice correctly. Although it can not happen for ipvlan now because there is no way to access phy_dev outside ipvlan. But it is necessary to add the reference operation to phy_dev to avoid the potential UAF problem in the future. In addition, add net device refcount tracker to ipvlan and fix some error comments for ipvtap module. --- v2->v3: - Make it clear that the problem can not happen now but for future. - Delete "Fixes: tag" to avoid backporting to stable. v1->v2: - Add "Fixes: tag" for fix patches. Ziyang Xuan (3): net: ipvlan: fix potential UAF problem for phy_dev net: ipvlan: add net device refcount tracker net: ipvtap: fix error comments drivers/net/ipvlan/ipvlan.h | 1 + drivers/net/ipvlan/ipvlan_main.c | 13 +++++++++++++ drivers/net/ipvlan/ipvtap.c | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) -- 2.25.1