From patchwork Thu Sep 26 01:41:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 278059 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 730ED2C016B for ; Thu, 26 Sep 2013 11:42:36 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A5FE64A0A9; Thu, 26 Sep 2013 03:42:24 +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 MXwUItgsih+X; Thu, 26 Sep 2013 03:42:24 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 178EF4A08B; Thu, 26 Sep 2013 03:41:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D492A4A0A8 for ; Thu, 26 Sep 2013 03:41:31 +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 n6otyGpVNz90 for ; Thu, 26 Sep 2013 03:41:24 +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-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by theia.denx.de (Postfix) with ESMTPS id 5F5CE4A088 for ; Thu, 26 Sep 2013 03:41:12 +0200 (CEST) Received: by mail-pa0-f46.google.com with SMTP id fa1so592458pad.19 for ; Wed, 25 Sep 2013 18:41:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PC2lmMv77za89gPnlNnMbx4MKyQfK2QMw3eJnG2aYCU=; b=ijouNoINukKT8sPEod+xYggD2k1z9uIbhDAA/hyLZ2u7/GArgjnjIE8J63KtlTNjOW 30VVWwmBd6XqbqIaEyadPXEuaN9xU1zdjRXe8S2K5BL3btD7AkhaUXNfDcDTs12mM2RO NBeIFVDtbzrf8CPG3MnC/M97PRAcP4ZGTG4Hn5n5R/znRgD4/PcRMyaNsI//Du/EPymI 0Bk5BqThaiXBltj3ndhmi3b+8G0AHeaZvH8PdA/mbFpkv0BNN1ZSyVwMtZthiD5+/2rH PJSg6b3NwCY5JKMfLultCJ9TEyEcWuZGIPQT7kbExG16HJPNtlrHib/MlUH0jKGvQDpR dXuw== X-Gm-Message-State: ALoCoQnpnX4S7tZW0xzcbR1pHd5NJxzrSlZaw6gtYP4GdcHj7HZCFeNffU8qbvNBf6jAEYR8watK X-Received: by 10.69.12.36 with SMTP id en4mr26249898pbd.54.1380159670129; Wed, 25 Sep 2013 18:41:10 -0700 (PDT) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPSA id iu7sm50581802pbc.45.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 25 Sep 2013 18:41:08 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.80) (envelope-from ) id 1VP0a3-0006tF-BK; Wed, 25 Sep 2013 18:41:23 -0700 From: Troy Kisky To: marek.vasut@gmail.com Date: Wed, 25 Sep 2013 18:41:05 -0700 Message-Id: <1380159678-26416-6-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1380159678-26416-1-git-send-email-troy.kisky@boundarydevices.com> References: <1380159678-26416-1-git-send-email-troy.kisky@boundarydevices.com> Cc: fabio.estevam@freescale.com, otavio@ossystems.com.br, leiwen@marvell.com, u-boot@lists.denx.de Subject: [U-Boot] [PATCH V5 05/18] 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. rx_req will be released by eth_reset_config which is called by eth_disconnect, which is called using the .disconnect member of usb_gadget_driver by mv_pullup in mv_udc which is called using the .pullup member of usb_gadget_ops by usb_gadget_disconnect which is called by usb_eth_halt which is called using the .halt member of eth_device by eth_halt which is called by TftpHandler when TFTP_ERR_FILE_NOT_FOUND or TFTP_ERR_ACCESS_DENIED occurs I trigger this with the following commands setenv ipaddr 10.0.0.2 && setenv netmask 255.255.255.0 && setenv serverip 10.0.0.1 setenv usbnet_devaddr 00:11:22:33:44:55 && setenv usbnet_hostaddr 00:aa:bb:cc:dd:ee setenv ethprime usb_ether && setenv ethact usb_ether && setenv ncip 10.0.0.1 tftpboot 10800000 10.0.0.1:missing_file Signed-off-by: Troy Kisky --- v4: expanded commit message v5: added trigger to commit message --- 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 988cffb..cc6cc1f 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -1536,6 +1536,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;