From patchwork Fri Feb 13 13:51:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksander Morgado X-Patchwork-Id: 439504 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BCA011402EC for ; Sat, 14 Feb 2015 00:51:19 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752509AbbBMNvK (ORCPT ); Fri, 13 Feb 2015 08:51:10 -0500 Received: from mail-we0-f177.google.com ([74.125.82.177]:50077 "EHLO mail-we0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535AbbBMNvJ (ORCPT ); Fri, 13 Feb 2015 08:51:09 -0500 Received: by mail-we0-f177.google.com with SMTP id m14so10853130wev.8 for ; Fri, 13 Feb 2015 05:51:08 -0800 (PST) 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; bh=IBGCqbRegvYCAXkxZfRhBn6W270aakstN6PJ9RZ8LzI=; b=IZMZVMMaZHCq1KsG+nQXeb7JHW/w0TJeBEmyRhqjXiIsOMtAWmkiP4kzjqGbbz+o+9 ewaXhyO385szQGIknTaoA0iOFmD7WbQibPC06GgOn99HIpWK9EjJOhv8kaAN3LTtpn3J nptyRyAW83deUgiwXsXRX60gmZyS6V0YVDIXzgujUerzdMtlnu+2XGUjXWIqhHUFpciL 8wpuCoAOReqaH3/UAKVQ96HWrAHjVEHZiL2/4ZfgTtAzVCWFkq9Cg9xUJPFZGCrK3uV4 ev3lUEV8ZWrZ6HvIu1GW5PwmvLLLJ6qNGKE/uwyll5CgjExMlv/5WKH/moFBbMnzDa95 ycrw== X-Gm-Message-State: ALoCoQnDWp5+GA0Ubkw2pPwtJrk2HPhUpCgWaNylTHcoXV1GbCfveNIXBcgPufvCPNjxubTUPq9e X-Received: by 10.194.173.138 with SMTP id bk10mr17995155wjc.112.1423835468106; Fri, 13 Feb 2015 05:51:08 -0800 (PST) Received: from athena.localdomain ([188.86.139.224]) by mx.google.com with ESMTPSA id hs7sm3051845wib.4.2015.02.13.05.51.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Feb 2015 05:51:06 -0800 (PST) From: Aleksander Morgado To: linux-usb@vger.kernel.org, netdev@vger.kernel.org Cc: j.dumon@option.com, Aleksander Morgado Subject: [PATCH] hso: fix rx parsing logic when skb allocation fails Date: Fri, 13 Feb 2015 14:51:02 +0100 Message-Id: <1423835462-3454-1-git-send-email-aleksander@aleksander.es> X-Mailer: git-send-email 2.3.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If skb allocation fails once the IP header has been received, the rx state is being set to WAIT_SYNC. The logic, though, shouldn't directly return, as the buffer may contain a full packet, and therefore the WAIT_SYNC state needs to be processed (resetting state to WAIT_IP, clearing rx_buf_size and re-initializing rx_buf_missing). So, just let the while loop continue so that in the next iteration the WAIT_SYNC state cleanly stops the loop. The WAIT_SYNC processing will be done just after that, only if the end of packet is flagged. Signed-off-by: Aleksander Morgado --- drivers/net/usb/hso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 6b8efca..9cdfb3f 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -914,7 +914,7 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt, /* We got no receive buffer. */ D1("could not allocate memory"); odev->rx_parse_state = WAIT_SYNC; - return; + continue; } /* Copy what we got so far. make room for iphdr