From patchwork Thu Apr 2 16:49:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 46728 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C9E02215A9 for ; Thu, 2 Apr 2015 16:49:53 +0000 (UTC) Received: by layy10 with SMTP id y10sf13246030lay.0 for ; Thu, 02 Apr 2015 09:49:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=1mt7qbhZp8ouF4fb5qzX2gvQ4WffuTsr3xCMFV7nx0A=; b=M+rLtX5SffI1LCn4GJY5LVNzkB9QFHkge3B/qe5dslDC510jjuxOA7GCvlsOIWUxfb dUukSG1N4jJQEB8Y44AscygaTZIMToBIkZXheGuDMBG5aimcSPgfEKaG4e4tQ6wPhJ2b yp6uesucZmpXcRXDJJ51yYp5vLqdn5YbEplnGU7gBrePMOsW+nYIIEkxSAsi5vVFX4YQ fcNIdvshqIxyPL16mtv8viDSprKO0qQDdyljgkdKML20dsk4ViR5awTsbx0F/RLQgYwL rjveeqqpcN061hbAG5AQ9Qu66xg4LXn0Q9ZuN94hQvUH6CXkXd2ytHznmvaikn3Y4BkD iTlQ== X-Gm-Message-State: ALoCoQluoiJzxzX3lBSwuXjm4oMm4l9A3KOCtTx552/Z0M+37j3nb3YJr1q2vZGxokwXPqqZKIwH X-Received: by 10.180.73.137 with SMTP id l9mr1321708wiv.5.1427993392462; Thu, 02 Apr 2015 09:49:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.2 with SMTP id ky2ls249390lab.107.gmail; Thu, 02 Apr 2015 09:49:52 -0700 (PDT) X-Received: by 10.152.2.232 with SMTP id 8mr41682643lax.8.1427993392021; Thu, 02 Apr 2015 09:49:52 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id bf6si4677296lbc.57.2015.04.02.09.49.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Apr 2015 09:49:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbzk7 with SMTP id zk7so47458002lbb.0 for ; Thu, 02 Apr 2015 09:49:51 -0700 (PDT) X-Received: by 10.112.8.76 with SMTP id p12mr37897587lba.29.1427993391470; Thu, 02 Apr 2015 09:49:51 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp1461950lbq; Thu, 2 Apr 2015 09:49:50 -0700 (PDT) X-Received: by 10.55.55.142 with SMTP id e136mr46398455qka.37.1427993389949; Thu, 02 Apr 2015 09:49:49 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 21si5542661qhf.50.2015.04.02.09.49.48; Thu, 02 Apr 2015 09:49:49 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 14963650B0; Thu, 2 Apr 2015 16:49:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 74046650A7; Thu, 2 Apr 2015 16:49:46 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 875E9650A9; Thu, 2 Apr 2015 16:49:44 +0000 (UTC) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by lists.linaro.org (Postfix) with ESMTPS id 12FCF650A7 for ; Thu, 2 Apr 2015 16:49:44 +0000 (UTC) Received: by wibgn9 with SMTP id gn9so112551298wib.1 for ; Thu, 02 Apr 2015 09:49:43 -0700 (PDT) X-Received: by 10.194.177.167 with SMTP id cr7mr91253719wjc.19.1427993382393; Thu, 02 Apr 2015 09:49:42 -0700 (PDT) Received: from e106441.cambridge.arm.com ([2001:41d0:a:3cb4::1]) by mx.google.com with ESMTPSA id a13sm7989437wjx.30.2015.04.02.09.49.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Apr 2015 09:49:41 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Thu, 2 Apr 2015 17:49:20 +0100 Message-Id: <1427993360-26324-1-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 X-Topics: patch Subject: [lng-odp] [PATCH] linux-generic: pktio: fix SEGV after odp_pktio_inq_remdef() X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stuart.haslam@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Calling odp_pktio_inq_remdef() causes the pktio's inq_default to be set to ODP_QUEUE_INVALID, but when the scheduler later polls the pktio it fails to check the validity of inq_default and ends up passing a bogus pointer to queue_enq_multi(). Signed-off-by: Stuart Haslam Reviewed-by: Ciprian Barbu --- platform/linux-generic/odp_packet_io.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 45303f6..73a4be2 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -685,6 +685,9 @@ int pktin_poll(pktio_entry_t *entry) if (odp_unlikely(is_free(entry))) return -1; + if (odp_unlikely(entry->s.inq_default == ODP_QUEUE_INVALID)) + return -1; + num = odp_pktio_recv(entry->s.handle, pkt_tbl, QUEUE_MULTI_MAX); if (num < 0) {