{"id":814498,"url":"http://patchwork.ozlabs.org/api/patches/814498/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/b930159de5531a4d216a1cd2c2ef03aa41f421f9.1505562794.git.dcaratti@redhat.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<b930159de5531a4d216a1cd2c2ef03aa41f421f9.1505562794.git.dcaratti@redhat.com>","list_archive_url":null,"date":"2017-09-16T12:02:21","name":"[net] net/sched: cls_matchall: fix crash when used with classful qdisc","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"209a1652640c8558d4be61aeaa19ec506946af41","submitter":{"id":69455,"url":"http://patchwork.ozlabs.org/api/people/69455/?format=json","name":"Davide Caratti","email":"dcaratti@redhat.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/b930159de5531a4d216a1cd2c2ef03aa41f421f9.1505562794.git.dcaratti@redhat.com/mbox/","series":[{"id":3435,"url":"http://patchwork.ozlabs.org/api/series/3435/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=3435","date":"2017-09-16T12:02:21","name":"[net] net/sched: cls_matchall: fix crash when used with classful qdisc","version":1,"mbox":"http://patchwork.ozlabs.org/series/3435/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814498/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814498/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=dcaratti@redhat.com"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xvW9Y0FZSz9t2Q\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 16 Sep 2017 22:02:41 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751262AbdIPMCg (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSat, 16 Sep 2017 08:02:36 -0400","from mx1.redhat.com ([209.132.183.28]:50470 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751185AbdIPMCf (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tSat, 16 Sep 2017 08:02:35 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id A680D356E6;\n\tSat, 16 Sep 2017 12:02:34 +0000 (UTC)","from localhost.localdomain.com (ovpn-204-41.brq.redhat.com\n\t[10.40.204.41])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 30A2C61347;\n\tSat, 16 Sep 2017 12:02:27 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com A680D356E6","From":"Davide Caratti <dcaratti@redhat.com>","To":"Jiri Pirko <jiri@resnulli.us>, Jamal Hadi Salim <jhs@mojatatu.com>,\n\tJiri Benc <jbenc@redhat.com>, \"David S . Miller\" <davem@davemloft.net>","Cc":"netdev@vger.kernel.org","Subject":"[PATCH net] net/sched: cls_matchall: fix crash when used with\n\tclassful qdisc","Date":"Sat, 16 Sep 2017 14:02:21 +0200","Message-Id":"<b930159de5531a4d216a1cd2c2ef03aa41f421f9.1505562794.git.dcaratti@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.30]);\n\tSat, 16 Sep 2017 12:02:34 +0000 (UTC)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"this script, edited from Linux Advanced Routing and Traffic Control guide\n\ntc q a dev en0 root handle 1: htb default a\ntc c a dev en0 parent 1:  classid 1:1 htb rate 6mbit burst 15k\ntc c a dev en0 parent 1:1 classid 1:a htb rate 5mbit ceil 6mbit burst 15k\ntc c a dev en0 parent 1:1 classid 1:b htb rate 1mbit ceil 6mbit burst 15k\ntc f a dev en0 parent 1:0 prio 1 $clsname $clsargs classid 1:b\nping $address -c1\ntc -s c s dev en0\n\nclassifies traffic to 1:b or 1:a, depending on whether the packet matches\nor not the pattern $clsargs of filter $clsname. However, when $clsname is\n'matchall', a systematic crash can be observed in htb_classify(). HTB and\nclassful qdiscs don't assign initial value to struct tcf_result, but then\nthey expect it to contain valid values after filters have been run. Thus,\ncurrent 'matchall' ignores the TCA_MATCHALL_CLASSID attribute, configured\nby user, and makes HTB (and classful qdiscs) dereference random pointers.\n\nBy assigning head->res to *res in mall_classify(), before the actions are\ninvoked, we fix this crash and enable TCA_MATCHALL_CLASSID functionality,\nthat had no effect on 'matchall' classifier since its first introduction.\n\nBugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1460213\nReported-by: Jiri Benc <jbenc@redhat.com>\nFixes: b87f7936a932 (\"net/sched: introduce Match-all classifier\")\nSigned-off-by: Davide Caratti <dcaratti@redhat.com>\n---\n net/sched/cls_matchall.c | 1 +\n 1 file changed, 1 insertion(+)","diff":"diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c\nindex 21cc45caf842..eeac606c95ab 100644\n--- a/net/sched/cls_matchall.c\n+++ b/net/sched/cls_matchall.c\n@@ -32,6 +32,7 @@ static int mall_classify(struct sk_buff *skb, const struct tcf_proto *tp,\n \tif (tc_skip_sw(head->flags))\n \t\treturn -1;\n \n+\t*res = head->res;\n \treturn tcf_exts_exec(skb, &head->exts, res);\n }\n \n","prefixes":["net"]}