Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp636482rwj; Sat, 17 Dec 2022 14:36:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf7TdNwNOHQmB9gRrm+uordqlbTSKlwxKWinvl2h0XfyNbYbhLez39ycUoIdmupbaBASi0R4 X-Received: by 2002:a05:6a20:7f89:b0:9d:efbf:6622 with SMTP id d9-20020a056a207f8900b0009defbf6622mr62261454pzj.48.1671316568299; Sat, 17 Dec 2022 14:36:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671316568; cv=none; d=google.com; s=arc-20160816; b=0LckvWzKA0WSs+EylW6Utm1qZX1Jgi0JHrzaBQTuMOcNih6gII/MmA/BNyTuYa2bhV +9FOzRxEJI2HDYlDzNqD0f4TpfhkD0VBH/vRlFNujluyFiOiDBbHQ6Qt5vNPU5UhuBWy NKwl46+Q+GWHZILyDMyodZ8A3tOmrXaslCywcq4pahfH8XJNEO58NDPXqIOep9+E8q9p /PVM2km9AkmiuSj2py2jYVeHPtynuRREc7Smd/h63QiuBEoENThqn/KUuYw3YkDdKupA 2kIgs0LYTii3eQYODuYSUdtm4z356Db0EZA8Mi4m3L/w3yAQ0UDIUI2zF9EvmRb8AEic jOsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HtFHmDiZdhCBd3AYorc5R49zCwK13HQcbUolbEz3R6U=; b=AUBCkqn3nz28bH6a7eRN1AJgklQJig/MKppuDBA1ZYIcUXW8uBUMRifIf75MvKZsKl J6H2Hd0GUMaEm558T8n5xykXk/logqJDrPZ8nanPOUytCYxzUqg9IDYqc5LuBza46mQK HfiW/PHA11RactK36I1/a20sMx3zOy/408i1w0sKsTqnXU5yXW6MkM3OhkwnxqXNLg8y uLgvqRJNZQcS9it2eAoAOR//84QTOXK4HBFRy0DnlKogYQ9pscuwiOzNf/dfwWOhA0G2 9wCOttWFuMZ1UEH07nIaQzglWVZwDWuuCxn/Lm2vqyCQj7FZzSUW5k2l6PBvp1Z9t+Mx KgTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VErxAKwA; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm18-20020a656e92000000b00478bc014a2bsi2070055pgb.104.2022.12.17.14.35.59; Sat, 17 Dec 2022 14:36:08 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=VErxAKwA; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230089AbiLQVhY (ORCPT + 70 others); Sat, 17 Dec 2022 16:37:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbiLQVhU (ORCPT ); Sat, 17 Dec 2022 16:37:20 -0500 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EBC0AE5C; Sat, 17 Dec 2022 13:37:19 -0800 (PST) Received: by mail-qt1-x830.google.com with SMTP id c7so5509254qtw.8; Sat, 17 Dec 2022 13:37:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=HtFHmDiZdhCBd3AYorc5R49zCwK13HQcbUolbEz3R6U=; b=VErxAKwASmsxRND0FtHwJBvLHoqVGMxEX0602KEiOqqNSgMj1JhwpaZ0tMitBdfBhI ArThuzu9pnP85KphHcjpghaJV/pF3Zk80AJ/s+sulAFmIDKHuFoToZ1PdY4W9KgxFY6K Pghyol2GXMRyB88BBWQrKn9JdZtGu/ZLMuKouOd+ex2zqWkXJmJiqRdn1rZfYYCqocBS yKZd2aQM2DanaHrpKs+WgTkGBy5aHXYPYYE+leWITF6AZa7ah83r6AP8znNHHsKC5e7g olPGD+/NTOn8RGS20X0HI5ah5UFVj8mdg4DZLxsthAuPHXwpPnAoVX/05/Gv1walKIe7 P1zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HtFHmDiZdhCBd3AYorc5R49zCwK13HQcbUolbEz3R6U=; b=o/S8IEZc1+RMtVeBAZvyW6eJWrMshl4cPYBMw1rzndFpyBCUh5W8nGzo9/NMPpwIv6 Eh6CLblgQDK4iTKOoZRzQRTPZJ1m5TEckiT6/RbgYTtPI6i83T8hom9o3uXah0d5YtPD qSYkapxMiroeNRssnf9uFIbmq3mrfLoYZIxqgUyMH33XPFQ6Zr1AbTRHzCu7+OSD1d5i 954Nb9aoBL/yEPzRqjfmjBpxaNnORM7dpZECbtjSYYumjBr3x4H5p9Ryl85rySbWWi6R rrbvOCckpy1Cp+KCjxHU+MFTrt0lYbFEsN4NtYzHagyr8e1YdkJMFFAlLYsmOINR2UBP Rs8g== X-Gm-Message-State: ANoB5pl3/ZGgQIAz5f2UVR/N5TBgP4qvV4zmEPeYbw5vVyexrWFGXWkf 822Bv8D02Kg4kkGmEvqX/l4= X-Received: by 2002:ac8:51d0:0:b0:3a7:e271:fc05 with SMTP id d16-20020ac851d0000000b003a7e271fc05mr47664883qtn.3.1671313038289; Sat, 17 Dec 2022 13:37:18 -0800 (PST) Received: from localhost ([2600:1700:65a0:ab60:5eb1:3c61:24e:7911]) by smtp.gmail.com with ESMTPSA id s5-20020a05620a254500b006f9f714cb6asm4155158qko.50.2022.12.17.13.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Dec 2022 13:37:16 -0800 (PST) Date: Sat, 17 Dec 2022 13:37:15 -0800 From: Cong Wang To: Paolo Abeni Cc: Jun Nie , jhs@mojatatu.com, jiri@resnulli.us, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net v2] net: sched: ematch: reject invalid data Message-ID: References: <20221214022058.3625300-1-jun.nie@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 On Thu, Dec 15, 2022 at 01:50:43PM +0100, Paolo Abeni wrote: > On Wed, 2022-12-14 at 10:20 +0800, Jun Nie wrote: > > --- > > net/sched/em_cmp.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/net/sched/em_cmp.c b/net/sched/em_cmp.c > > index f17b049ea530..0284394be53f 100644 > > --- a/net/sched/em_cmp.c > > +++ b/net/sched/em_cmp.c > > @@ -22,9 +22,14 @@ static int em_cmp_match(struct sk_buff *skb, struct tcf_ematch *em, > > struct tcf_pkt_info *info) > > { > > struct tcf_em_cmp *cmp = (struct tcf_em_cmp *) em->data; > > - unsigned char *ptr = tcf_get_base_ptr(skb, cmp->layer) + cmp->off; > > + unsigned char *ptr; > > u32 val = 0; > > > > + if (!cmp) > > + return 0; > > It feels like this is papering over the real issue. Why em->data is > NULL here? why other ematches are not afflicted by this issue?? > > is em->data really NULL or some small value instead? KASAN seams to > tell it's a small value, not 0, so this patch should not avoid the > oops. Have you tested it vs the reproducer? Right. I think I have found the root cause, let me test my patch to see if it makes syzbot happy. Thanks.