Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp579428pxf; Thu, 8 Apr 2021 08:52:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxP9VBzJr6O3IsxSBS/ULj5rqi90BDwx1AoduKMh9kugP47JkgSwBDBjWV+7P/IT5yqOlzE X-Received: by 2002:a17:902:6541:b029:e6:27a4:80fb with SMTP id d1-20020a1709026541b02900e627a480fbmr8175737pln.15.1617897155079; Thu, 08 Apr 2021 08:52:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617897155; cv=pass; d=google.com; s=arc-20160816; b=mC1cbZBA67B4LYVa90PtIIe0TUtdk/gdDv6MR/kQL4Mop2OEeCuoH0O1vHLTU+9/5p vW67NhO7iH+fOE4ESZrMPrWU/tt8wSd4qUI0v0W/SfaJ/ZFYyptedL8bsvM1/+CHRFjL s9loRw36b0Up5EV1b0h8nusUZKKWhoNBgP1iP5gdsmuMQ1v2ffsETQamHwHa2AJU0ry4 GXuCFNP8nqhnR2vEYXcJQCSAzbPvJZWD/0AUBhRY+Akahq+TH1TmCnd0CFJqLUdwzARQ acZRfkcpaGHlkQGGyUX8VsJOIr0SQ5PhRJ8HwYDaORYLNHBqN0hI7wqJGdMc0yQYYnnw XwJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature; bh=ecUIOW5LyYut+sXClduxp5xyMCZIddfuOJkhiVEps20=; b=g1ujHf+oXbL/w16Mo1Qd/s+lHzi4wVVt2A+iQDW9oLs2A8Oj20kFsXEbu331qrCaAx w+GuR/LjZS6Fo1Inzfj/1fAykaWbYfwJ/FvtYkSK/As55UJa9Bh9862pVVpbvHQbGpcI q0on8XmfgfnT9PtbFxri2hbYEfvHbkkyp6sbOaYjbpqzog3H2e7hm3wsgWsnLEivU6gI 2c9J165Y6a2fmaUK07+020ii46R1mEyWVa9Gtolrz2RkTOrtQ0Uo2S4jgKSGfJt6uoyi PJL4Dx46xNR/etMz30XBvuAQ37ReBI1knqE+iVJhCtlNUyfGCbKgFQdUytMUS6d79uTk 7B0A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector2 header.b=XGno+TAf; arc=pass (i=1 spf=pass spfdomain=virtuozzo.com dkim=pass dkdomain=virtuozzo.com dmarc=pass fromdomain=virtuozzo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mu11si11870675pjb.2.2021.04.08.08.52.22; Thu, 08 Apr 2021 08:52:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector2 header.b=XGno+TAf; arc=pass (i=1 spf=pass spfdomain=virtuozzo.com dkim=pass dkdomain=virtuozzo.com dmarc=pass fromdomain=virtuozzo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232042AbhDHPwD (ORCPT + 99 others); Thu, 8 Apr 2021 11:52:03 -0400 Received: from mail-db8eur05on2134.outbound.protection.outlook.com ([40.107.20.134]:55553 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231480AbhDHPwC (ORCPT ); Thu, 8 Apr 2021 11:52:02 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=coHS+iBdW02orOM/NdImJ7muoeVgl6zSRm081xUf8gFMPCOQN30rcmMXy4yCOIhjj4KvdC2tojcm7lWKJxDLVvbckJIv5bdxzCEM+PPCnLijL848I4Swpe3g1kNyH04EOZndrfBvtzWQgT5Dij6BUaVIBC3fwmZy79a27N8rIjnWA/ev+3rZ3SrVq/a9OekxJtWft372isjebpezNNVKy5UwNenQo4yB9rg/VnHhFyHE4wSmLBjKc4gqCL9SZe9zbbuVXYY654S7Md3DicMDw2oX3M9JgikvNblCmDH8kD8VGHQvtZLcUugNnn0yAbGyaOjJIiQcUjUR/tu8FolqWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ecUIOW5LyYut+sXClduxp5xyMCZIddfuOJkhiVEps20=; b=VtwxAY+21H3z4at4FG4A6bX2oQLQ5GuLDa8XTXRLSAaUtY/4042/6OrPp3YtrLCTLjdMixxYX4EIxP6PHfi1SmGhwSFz93YCnjZUztDdKrHjAnChO1P8YMLD3mSdOeIXXUKG/SJMiCaaW8r41k9t8H+lwiwmfiMThDQY/pfOMmIEurWBSVYMDjE7m3ZYD45zIco0YKnBBPdAUkOnA7MNPG6udsTSleJI5vCYv/mdUg9ia29HFzoun3Wj2Gjckkktu9hdmDbeO88GzSvE5VuJ3iSH9v33C13wNcqgpNOR2WHSgUEWdQZ6vrrv6/zDwwiI3NIlNhJFg40ZR6BXiwFwfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ecUIOW5LyYut+sXClduxp5xyMCZIddfuOJkhiVEps20=; b=XGno+TAfZNvIeKUtqflEBKaZYcnCEZSjMEkQOdcKGEV1aH4O9yn680nWZGbh0whOETo6ZWvZiIXd4FV6/RI1AStIrxvQG/po1eRXcju18SkB9y27rnoeO13+oczNWU6mNAheCYu/7+o93Q1zQwPGvJcaObzlb8UlnrLnnTf/7jY= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=virtuozzo.com; Received: from VE1PR08MB4989.eurprd08.prod.outlook.com (2603:10a6:803:114::19) by VI1PR0801MB2109.eurprd08.prod.outlook.com (2603:10a6:800:8a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.32; Thu, 8 Apr 2021 15:51:48 +0000 Received: from VE1PR08MB4989.eurprd08.prod.outlook.com ([fe80::d1ec:aee1:885c:ad1a]) by VE1PR08MB4989.eurprd08.prod.outlook.com ([fe80::d1ec:aee1:885c:ad1a%5]) with mapi id 15.20.3999.034; Thu, 8 Apr 2021 15:51:48 +0000 Subject: Re: [PATCH] net: sched: sch_teql: fix null-pointer dereference To: Eric Dumazet , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210408151431.9512-1-ptikhomirov@virtuozzo.com> <0c385039-3780-b5d0-ba36-c1c51da9bc08@gmail.com> From: Pavel Tikhomirov Message-ID: Date: Thu, 8 Apr 2021 18:51:46 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 In-Reply-To: <0c385039-3780-b5d0-ba36-c1c51da9bc08@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [81.200.17.122] X-ClientProxiedBy: AM0PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:208:1::40) To VE1PR08MB4989.eurprd08.prod.outlook.com (2603:10a6:803:114::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.192] (81.200.17.122) by AM0PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:208:1::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Thu, 8 Apr 2021 15:51:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aee6484e-cd7c-48bf-1205-08d8faa6381c X-MS-TrafficTypeDiagnostic: VI1PR0801MB2109: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4gqdNdrakjdBYzEzEi8oxCxLSDdhxcQVZRyLHR1kJvGCgjScwbNKJZV5VZ/yY0myDhtd0SI1fNphJHTkNPWlknjnRrc4WNxyGJ5iQuTthgQ0xUjd0g1gHG7k9BDMuk1ZYT8JalklI8jmqsoI6J/yI2iYI2VLZ4umv8POLzNPSfArYLtQUiUixPD2gnVK/UTcnpUY/W40+84ff4ho0XjsjdOa1vdx5mNo/v4KltbYdeEbERpbCKggGmtS901fb6pJ7a2u4ouZCcSr6q9Um0/rXbq0Yg3r2cx02M0K9LRmKlm1pJVg4nLgjHednUE9FCn6WPWlHlFDrYekWn8JRS+7gvRtHqfTo+1NJcMxZJmiFY+xr2zt34oCie67KyGxxt8naYCuNW96GsnLEBA48T64H1XvE312xeMR+VdW+YuGV1Km97hWhPX9hqAqNbiPrix/lRmMWtQzfUoxUiycGJyamJzc6t+jA3ZUFKf/E7fy5T2DP4Mhrnicjoa+QQKilY67GKXyHNpEgTmWWA76P5cWsanGklxbedVlz5LGUNn/UWmOd4tYjyhyxx10G6KDdcjk00iWpnyDy3tNwboiQZ/CtRsrn3vy7WK0b/RmrnVb5S6pa0d+OZBDi+tU27SVBIjULWqIeAWhTpjlRyC9T6u+Cip3I5hETtx/nr2Kh6zod7OTJGH5+L7T+00gnwvJIOpEFMq5/A5GdmDW1ON8VEvgxSDSzTstKm7dUqM+/8SnIA2/dD0YkoJbN0PJfL72d61llLGxv+tu7pl1nc9AVa01FaIR+mQWDFrdgISkOeGGioMI2c69ueEZ9vXSDrIGpuy2cfvT3kc5Im8wEhfhRbAbtQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4989.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(376002)(136003)(396003)(39840400004)(366004)(54906003)(966005)(316002)(31696002)(86362001)(52116002)(66946007)(8676002)(478600001)(83380400001)(2616005)(5660300002)(8936002)(6486002)(38350700001)(110136005)(2906002)(956004)(36756003)(4326008)(186003)(66476007)(31686004)(16526019)(66556008)(16576012)(53546011)(26005)(38100700001)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?N3BCNEdad3lmeXU3V0tQdmc2bUVWejZxWWRVMlp0ak9jbjdEMjcvYlFMSm0x?= =?utf-8?B?d20yc01mbWlmVkczR0VGRVQxak53dVI3aTg2UnZMeVVEL1EwbGdDbm5IR1Fv?= =?utf-8?B?Zy9CZmtlWS9rSE9hbER1NGEwajVsRWh1TTgwTXZFd2lSa3R5b05ueDdUNGtZ?= =?utf-8?B?WXpKZEpFcjJOdW9Da3dTWU9RT21yUzB6ZXNwWklLRk1HRGRSUWtjZFJ1ZGZN?= =?utf-8?B?MkRtdTgvWGk0VnBEVDdSSTZXd1V0TngrUGt0bE56bndrbzRHdXJvRXVBaDd4?= =?utf-8?B?RWZXUmJ2VlZ3OUw2SVZnWVVTamd2ODY4Z1RnTVhzQ2RZQnBUSGN1d3RTeXUz?= =?utf-8?B?T255bVZZ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rk5rcks3bDZJbGxKSzM2N3lrN3FPSEZQQXNxMmM4N0ZnWGJ1MEk1VXYzWUlO?= =?utf-8?B?N2d5WUI5T25BSXBpQ2h4ZkkxLytvelJTNFhIWFQzdFd6MGg2dWhxSGN0REhM?= =?utf-8?B?Q1pnUkc2cGpwTEI2b0tLcHUwSjNTc210bnI2RTlCNGVZVW5PT21UMmtDSkxM?= =?utf-8?B?ZHZ5Q0hDV0JoRjd6c1M4R2gxTndpRExVSDFKTUppbktoV3dFZlRyUng2Q1J0?= =?utf-8?B?RmdOM3lDTk0waUdEM1lpSUhQUjdVdE9UV1VYYWZxd3NwTDRCNVh5bzNYeWZh?= =?utf-8?B?UkZ1SERQbkpPL29NSmh3OEI1MU5xK1IyTk5IYnJlOVh0Uy91c3pjMGcyMU9v?= =?utf-8?B?V3d0L05vaXJxVjhiSkM2eXFFUVduZ044QmxzbnMxQnNidjh3c25ZaGVqVlVI?= =?utf-8?B?S3QwV3FKbGNINlhsRytib1RsMWNJODRoVFN4L0QvV1B0S21rU1NRVlJrVzJW?= =?utf-8?Q?Nl1gVr5CtW+xwtqkbgwtJFVDFGJa46QgtMg5nfG?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: aee6484e-cd7c-48bf-1205-08d8faa6381c X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4989.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2021 15:51:48.7393 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XgNwKNHP7d9AEK83E0v7RJuHPJ1fQ6Mgm2oF9QNV+HKYEY+UGMLyh53YMOZ8J25v5/371sQIw2c9SgEmU7WxdfszEYDqITkYD8yCbFcxRzc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2109 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/8/21 6:26 PM, Eric Dumazet wrote: > > > On 4/8/21 5:14 PM, Pavel Tikhomirov wrote: >> Reproduce: >> >> modprobe sch_teql >> tc qdisc add dev teql0 root teql0 >> >> This leads to (for instance in Centos 7 VM) OOPS: >> >> >> >> Null pointer dereference happens on master->slaves dereference in >> teql_destroy() as master is null-pointer. >> >> When qdisc_create() calls teql_qdisc_init() it imediately fails after >> check "if (m->dev == dev)" because both devices are teql0, and it does >> not set qdisc_priv(sch)->m leaving it zero on error path, then >> qdisc_create() imediately calls teql_destroy() which does not expect >> zero master pointer and we get OOPS. >> >> Signed-off-by: Pavel Tikhomirov >> --- > > This makes sense, thanks ! > > Reviewed-by: Eric Dumazet Thanks! > > I would think bug origin is > > Fixes: 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation") > > Can you confirm you have this backported to 3.10.0-1062.7.1.el7.x86_64 ? > According to our source copy it looks backported to 1062.7.1, please see: https://src.openvz.org/projects/OVZ/repos/vzkernel/browse/net/sched/sch_api.c?at=refs%2Ftags%2Frh7-3.10.0-1062.7.1.el7#1167 -- Best regards, Tikhomirov Pavel Software Developer, Virtuozzo.