Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp837675ybi; Fri, 12 Jul 2019 05:29:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2cM+etgaMDoYqcomdBQlz764sNzy0cjAsiczjnzKOL8SFKpV/9Fk7YUduLHl58NiBguud X-Received: by 2002:a17:902:8d92:: with SMTP id v18mr11304608plo.211.1562934557251; Fri, 12 Jul 2019 05:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934557; cv=none; d=google.com; s=arc-20160816; b=bZ+/NKI/2BanIR/CsNj2E4dcvangRM+UjeYn0SjB/J1pLyLgs+suXKftQffofjhNM7 reqvURsrEdSUY9lagOuyJzYRhGcYr/g/ynUKqAaCUTwZ9Sl0EyhPW8sGltFwSB2bgyai lSlgG4idEZ/FQ5M3zGfvqDG0rbQcDBEsgxBoYblw0AZboVjpsWF3nkkiaBC9dnbmcp0C B4hvfK1AXXP5LMDSmiIRAd80F4RSLr23gMcuJagOQR5yCswl5G3m38L8vFcRg5LH5o9y bC16LezmhxHmClPo6Hnkglr2uNv2iiz/IoExo+k5AwH7JJlFTT+LAyPfFokGxMCOjFr7 HEkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d9P0a3niEF3TMW9kICdJdbMLcZ0ThgQObtNAJ8AHJgw=; b=LJq4sxZpcd78ih248EgiQCToTpsoIu8sBCLRUBWIUz6JQzCLvw3RAm3P6dQpgiwhq1 msmMDbySPRuH9OvcHvD/OOD3GR2rDSa4RCcN0e2sHol0UV1rEJ+fymDoeIZM3bRfOMqu zPKz/Dzv5J4mGJz3HAaSmtMlcJLFFl/UkdJ3codddTTPVtGuSO25Ahdxa8B3PXCTjrVR nTvjW/qYwlucj0vMv67wX9+Xx9Rm8vUjYv+g33m+rVupBFSLmJ7tpGu2xm5QFiFI7fxC OINZEBruz1jDmE1yHeLtAsPQBmAwiiZRp9pbWHJJqQjqn7XQLbjVnkeIM+fjyivtOZNB AzGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EXTx6P30; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si7497104plp.354.2019.07.12.05.29.02; Fri, 12 Jul 2019 05:29:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EXTx6P30; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727867AbfGLM2H (ORCPT + 99 others); Fri, 12 Jul 2019 08:28:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:41450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727525AbfGLM2F (ORCPT ); Fri, 12 Jul 2019 08:28:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CEDA7208E4; Fri, 12 Jul 2019 12:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934484; bh=JEl2xMhTXjcFazKlCKNupjlOtV5Zgb3boqeMf0NtShA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EXTx6P30vDDe+X7azURliTPa+DnoUgIEMLSE3WX687x2NraSuqGY7c+zeg34XpbGp gH/EC3H7HB3xlLUgt87qUjsbPOq17QhfzAln4IM4urJHp+MAQTUjmBP4jCnLHqKVb4 jiVgmgXbY6BUPf7NP8CreC8jvHNjmWyr2F3BWfvg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniele Palmas , Reinhard Speyerer , "David S. Miller" , Sasha Levin Subject: [PATCH 5.1 068/138] qmi_wwan: add support for QMAP padding in the RX path Date: Fri, 12 Jul 2019 14:18:52 +0200 Message-Id: <20190712121631.279494742@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 61356088ace1866a847a727d4d40da7bf00b67fc ] The QMAP code in the qmi_wwan driver is based on the CodeAurora GobiNet driver which does not process QMAP padding in the RX path correctly. Add support for QMAP padding to qmimux_rx_fixup() according to the description of the rmnet driver. Fixes: c6adf77953bc ("net: usb: qmi_wwan: add qmap mux protocol support") Cc: Daniele Palmas Signed-off-by: Reinhard Speyerer Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/qmi_wwan.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index e657d8947125..090227118d3d 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -153,7 +153,7 @@ static bool qmimux_has_slaves(struct usbnet *dev) static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb) { - unsigned int len, offset = 0; + unsigned int len, offset = 0, pad_len, pkt_len; struct qmimux_hdr *hdr; struct net_device *net; struct sk_buff *skbn; @@ -171,10 +171,16 @@ static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb) if (hdr->pad & 0x80) goto skip; + /* extract padding length and check for valid length info */ + pad_len = hdr->pad & 0x3f; + if (len == 0 || pad_len >= len) + goto skip; + pkt_len = len - pad_len; + net = qmimux_find_dev(dev, hdr->mux_id); if (!net) goto skip; - skbn = netdev_alloc_skb(net, len); + skbn = netdev_alloc_skb(net, pkt_len); if (!skbn) return 0; skbn->dev = net; @@ -191,7 +197,7 @@ static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb) goto skip; } - skb_put_data(skbn, skb->data + offset + qmimux_hdr_sz, len); + skb_put_data(skbn, skb->data + offset + qmimux_hdr_sz, pkt_len); if (netif_rx(skbn) != NET_RX_SUCCESS) return 0; -- 2.20.1