From patchwork Thu Aug 1 22:18:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 264136 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id CA6302C0091 for ; Fri, 2 Aug 2013 08:23:16 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0528F4A040; Fri, 2 Aug 2013 00:22:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eVj6jcxkMOJc; Fri, 2 Aug 2013 00:22:37 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DFCE94A03F; Fri, 2 Aug 2013 00:20:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5199F4A094 for ; Fri, 2 Aug 2013 00:20:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4anXH50Fwh-o for ; Fri, 2 Aug 2013 00:20:01 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by theia.denx.de (Postfix) with ESMTPS id 4F0244A032 for ; Fri, 2 Aug 2013 00:19:27 +0200 (CEST) Received: by mail-pa0-f50.google.com with SMTP id fb10so2649979pad.9 for ; Thu, 01 Aug 2013 15:19:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=BmzKFwcVImOjac//JMbld36YbdXN6TF82W2q7p0B2qk=; b=XfBUWfAjJbiZXjzJxcHh5qcBAQoWZMY9sBICdCu40WG8X0k4s6f97rbtaJjCQj0TqD UpcSxD6bpduyKZIDhmGQ7cDDOsX+6nJlGPer9mBvs83wrCdnVyGRWDRC82lK525Fv5an qDhO1iluTrFT9RRO6RShBOtZYDFD1SLy+NxQUCMir77xbE4MJW3rRAl35oYe2+bEh/4Y CMYNv4OQqvIVfGkx1oqVxBca0YPTj7zWxR6fC2ARMFzCbuGf2r48yIG3O2fWH2oDEmFs GGtDxNGFsS0RG2r/J5wVTZnhJKwZdV/Z8FbMrk6dbom/2oJiNjoGadT1ICndotkBZzhz GyQQ== X-Received: by 10.68.189.103 with SMTP id gh7mr4195890pbc.142.1375395565740; Thu, 01 Aug 2013 15:19:25 -0700 (PDT) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPSA id 4sm4256495pbw.32.2013.08.01.15.19.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 01 Aug 2013 15:19:25 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.80) (envelope-from ) id 1V51DN-0004rb-Jh; Thu, 01 Aug 2013 15:19:21 -0700 From: Troy Kisky To: marek.vasut@gmail.com Date: Thu, 1 Aug 2013 15:18:31 -0700 Message-Id: <1375395521-18569-15-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1375395521-18569-1-git-send-email-troy.kisky@boundarydevices.com> References: <1375395521-18569-1-git-send-email-troy.kisky@boundarydevices.com> X-Gm-Message-State: ALoCoQlOtRCnahkwhgKqyd2GdILIJmjIFensillwVib46Jd6eZSnG6FmNZjCDgO09j5Wt6cBBn3T Cc: fabio.estevam@freescale.com, otavio@ossystems.com.br, leiwen@marvell.com, u-boot@lists.denx.de Subject: [U-Boot] [PATCH V2 10/20] usb: gadget: ether: return error from rx_submit if no request X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This prevents a crash if tftpboot is given a bad filename. Signed-off-by: Troy Kisky --- drivers/usb/gadget/ether.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index f583c6e..fe73c7b 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -1535,6 +1535,8 @@ static int rx_submit(struct eth_dev *dev, struct usb_request *req, */ debug("%s\n", __func__); + if (!req) + return -EINVAL; size = (ETHER_HDR_SIZE + dev->mtu + RX_EXTRA); size += dev->out_ep->maxpacket - 1;