From patchwork Fri Sep 20 03:29:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 276197 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 050892C00F4 for ; Fri, 20 Sep 2013 13:36:28 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C4F4A4A173; Fri, 20 Sep 2013 05:36:26 +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 qNad5UoHzE1t; Fri, 20 Sep 2013 05:36:26 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B81B94A167; Fri, 20 Sep 2013 05:36:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 48ADA4A167 for ; Fri, 20 Sep 2013 05:36:13 +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 6eWB5y1Isral for ; Fri, 20 Sep 2013 05:36:08 +0200 (CEST) X-Greylist: delayed 387 seconds by postgrey-1.27 at theia; Fri, 20 Sep 2013 05:36:02 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-pb0-f51.google.com (mail-pb0-f51.google.com [209.85.160.51]) by theia.denx.de (Postfix) with ESMTPS id 414BC4A15D for ; Fri, 20 Sep 2013 05:36:01 +0200 (CEST) Received: by mail-pb0-f51.google.com with SMTP id jt11so9232271pbb.10 for ; Thu, 19 Sep 2013 20:36:00 -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=bD4RT1XV2N9cUiRKbvGtU3QHbV7AKAx33J7qUzjkfyI=; b=jWwmFmhKAQDUpBJYTm+SsBoQTnuQ5y3j+nYiPdrKoxUQgoq2Cv7XAjDAH0VodVPoeP UWIzBXEUX3RH/4DJCUo/BfKSe2eBCwEARKSR1iHeezxml8UAlhecpUhZAS1Qk1zUZcrM TNF4R4RSI15JyKgNbrODb5iaB1qfR9izktck+d+XH8AfLLUqltTrg4358mFwE6c2a4VU /fFl4YQ1nLWZoIAyQVqyTh/iJkHsd6yn5SUGaVSSXgpsaWpcFkImx1OUHnNObWrFuihE 1dFpHzajtKDUkAXV1XekhGiv373P2eRHQw+UotQeH+/c7OnI/HaHWNWSF3O98y/q7TTZ sFRw== X-Gm-Message-State: ALoCoQmMxtKFU39vW6xpzqPhYg2apfo/dtYsEL1DQd2rbHDK8KZ0+ksOVjp/h/wc5RKLvxrQbkIq X-Received: by 10.66.233.37 with SMTP id tt5mr6218526pac.95.1379647774226; Thu, 19 Sep 2013 20:29:34 -0700 (PDT) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPSA id hx1sm12597018pbb.35.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 19 Sep 2013 20:29:32 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.80) (envelope-from ) id 1VMrPd-0000hR-L3; Thu, 19 Sep 2013 20:29:45 -0700 From: Troy Kisky To: marek.vasut@gmail.com Date: Thu, 19 Sep 2013 20:29:27 -0700 Message-Id: <1379647780-2623-5-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1379647780-2623-1-git-send-email-troy.kisky@boundarydevices.com> References: <1379647780-2623-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 V4 04/17] 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 Signed-off-by: Troy Kisky --- v4: expanded 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;