From patchwork Fri Mar 18 01:56:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ziyang Xuan (William)" X-Patchwork-Id: 12784744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AE90C433EF for ; Fri, 18 Mar 2022 01:39:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231540AbiCRBkq (ORCPT ); Thu, 17 Mar 2022 21:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbiCRBkq (ORCPT ); Thu, 17 Mar 2022 21:40:46 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6F8DBA32A; Thu, 17 Mar 2022 18:39:28 -0700 (PDT) Received: from canpemm500006.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KKRTJ4k8HzCqlP; Fri, 18 Mar 2022 09:37:24 +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; Fri, 18 Mar 2022 09:39:26 +0800 From: Ziyang Xuan To: , , CC: , , , , Subject: [PATCH net-next v2 0/3] net: ipvlan: fix potential UAF problem for phy_dev Date: Fri, 18 Mar 2022 09:56:50 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add the reference operation to phy_dev of ipvlan to avoid the potential UAF problem under the following known scenario: Someone module puts the NETDEV_UNREGISTER event handler to a work, and phy_dev is accessed in the work handler. But when the work is excuted, phy_dev has been destroyed because upper ipvlan did not get reference to phy_dev correctly. In addition, add net device refcount tracker to ipvlan and fix some error comments for ipvtap module. ------ 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(-)