From patchwork Thu Feb 14 10:24:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1041964 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qcaUo8e9"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="msVWzQed"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 440Xbl1Jpfz9sML for ; Thu, 14 Feb 2019 21:25:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Lx9H2PhjjDhf67ZuzeU1wzmG/+cNuAJMpmpB7O5WrFE=; b=qcaUo8e9FCob4J TSa1pCCtz97lLwv/N0cCOs9Y1snA/TNVuolv43Lxzv1IyvQv/aLtpdgOtAVn/bhl+ruHpapUfr2DA yVQIax/URtUtZJjFG4adX6w/sZ4kOB2Fws+XciUFhfwyZXcagGTAS1Q/CLMLQ+RpWP8rIZ3MfL0H4 5ZsemUPNEsn8Ov8dx15ulOYBl9nPip1nT3X06YdgYIBMtk0nGhnDdoiSXsEEcgu/FA/JjqChxoT8W Aku0nXO2AMXaw4UHppuQxYC5Tkm7RoKqziY8gV1x7ni9fVSNh10sBmBVB8ZjyZCiJg+30t2haJ8EL tEZgYjy7rQXu5ay2vqVw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1guEDE-0006PV-CC; Thu, 14 Feb 2019 10:25:48 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guECa-0004qY-JR for openwrt-devel@lists.openwrt.org; Thu, 14 Feb 2019 10:25:11 +0000 Received: by mail-lf1-x143.google.com with SMTP id l10so4122413lfh.9 for ; Thu, 14 Feb 2019 02:25:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KEcRLbcq0VO+5Ygbms+j26kX+lJqEJ1oy6WaDYTQHxg=; b=msVWzQedOAgOiKnpj/Ur8n4ccsSLebUmbhnbnPMTLtDTzb6Q06dI4JnsNM5NvRPrj1 rPI6FL9+1eDKzAVimNZwJRPMPCWzKwqnlH+V/CSrZ3A5t1zvwKre5G2e4SISqjLoIcnt bhXtv99rpFAPQithDMDa4tqGjLSAnqDAkDHBJ9XozIATLVMgpnOQ4A1VKR+bBUSEt0B+ dQ5eyFYsJ+NOkKAiVL6rzwmOZKFH10936PwMJusmo3YVmROGXTsqvZf8Ju6IFQcspuuv EWLBMqOvO9vCqnE/9mggA+i1+eyxJ5j+bsuV5x9VV8/Ff2bAHSjXAT6pgQy8p++gff+L B+vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KEcRLbcq0VO+5Ygbms+j26kX+lJqEJ1oy6WaDYTQHxg=; b=BTVvUGLESUNmdiO4yqzB7ZGgmJNcv59HwiyRwlrPp1yJQreTSgJf3ZDsT2nIeggt/b 0c2/zjEZSLQNK+WV+YIpAUCdgReflhANKEuuu6/SQRJ4i8ZKNIYtB6Ocv3t6ZrxSizz6 E+w+G4bAWaZMEDzNgpru5qvu03ZFH2sYITBjFMWhlj7p9JbYKx2lQYF1n1rBpqm1VjY/ K3z86GFhw2RK2iRG+qk75EI8U2aIq4+w6znOVOf6lw5mT8Pi0O9GpofXdFX2ItQkoeci XqJ7/3tLL6y7MQgIcKztIYDVzPr2DVyXBn01/h1HvOK/w7ZbXDwGULhx7MTIHSXQWJuT 7fww== X-Gm-Message-State: AHQUAubbqnkOb1ekr5UolddsatQT398QJL+2BygxcwQAu5BH9N/HWE8r PlIehwFFAPxYlU+HbumpfYIRAA== X-Google-Smtp-Source: AHgI3IZ+FWe7FFSmqjh8irXyZBIQehnWehcUSK0+dfc4cebB7lfjzPUskq7j/13e5tAIzvx5axQlJw== X-Received: by 2002:ac2:4318:: with SMTP id l24mr1748748lfh.75.1550139906327; Thu, 14 Feb 2019 02:25:06 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n189sm380392lfn.82.2019.02.14.02.25.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Feb 2019 02:25:05 -0800 (PST) From: Linus Walleij To: Greg Kroah-Hartman , stable@vger.kernel.org, openwrt-devel@lists.openwrt.org Date: Thu, 14 Feb 2019 11:24:29 +0100 Message-Id: <20190214102436.5092-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190214102436.5092-1-linus.walleij@linaro.org> References: <20190214102436.5092-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_022509_347418_095F2E63 X-CRM114-Status: GOOD ( 12.03 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:143 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Subject: [OpenWrt-Devel] [PATCH 03/10] ch9200: use skb_cow_head() to deal with cloned skbs X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: James Hughes , Liping Zhang , John Youn , Hauke Mehrtens , Dave Taht , Matthew Garrett , Eric Dumazet , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , "David S . Miller" , Felix Fietkau Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Eric Dumazet We need to ensure there is enough headroom to push extra header, but we also need to check if we are allowed to change headers. skb_cow_head() is the proper helper to deal with this. Fixes: 4a476bd6d1d9 ("usbnet: New driver for QinHeng CH9200 devices") Signed-off-by: Eric Dumazet Cc: James Hughes Cc: Matthew Garrett Signed-off-by: David S. Miller --- drivers/net/usb/ch9200.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/usb/ch9200.c b/drivers/net/usb/ch9200.c index 8a40202c0a17..c4f1c363e24b 100644 --- a/drivers/net/usb/ch9200.c +++ b/drivers/net/usb/ch9200.c @@ -254,14 +254,9 @@ static struct sk_buff *ch9200_tx_fixup(struct usbnet *dev, struct sk_buff *skb, tx_overhead = 0x40; len = skb->len; - if (skb_headroom(skb) < tx_overhead) { - struct sk_buff *skb2; - - skb2 = skb_copy_expand(skb, tx_overhead, 0, flags); + if (skb_cow_head(skb, tx_overhead)) { dev_kfree_skb_any(skb); - skb = skb2; - if (!skb) - return NULL; + return NULL; } __skb_push(skb, tx_overhead);