From patchwork Thu Feb 14 13:23:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 158386 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1366754jaa; Thu, 14 Feb 2019 05:24:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IaM1ovZYCZ8zpiNmb3NBhJ6v5g+5qN8Db4HFISFpK2v7Oq9x2lF1mZb1cKYBY5VTjd0+3yn X-Received: by 2002:a17:902:b941:: with SMTP id h1mr4220246pls.66.1550150675311; Thu, 14 Feb 2019 05:24:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550150675; cv=none; d=google.com; s=arc-20160816; b=pbFky7n9V6ujK9uI739qfQg5LiDL/cQeFiPbaj9nzj8KAMZMA370fAm3Zc0JX/mLT+ ndsy3F7cWLtNbMmeyooWyaRr8TwQKeF0/PBtx7LUPa0Lq7cqC7+PRois3/elCN1wFp4Z DCt+0mU90vwUaAZ6cg8H4XgrO+EtotzxpRo0D3FCzRLmfoNLeuWMHfPSvSta/m/QxfiY L2B1U9N3U8IZ4r5GbL9aRUCL0OBGvwX+JhG4brFrVeJMdyjxJ3/LpIYfaKPKgYflTzt4 nW5u+X4CdUPj/dIQ/aIAt1XQpz/abKBTlNPxjZvO1jpc9lE0KrnaIoWw0zju8q6Fco/R B3nQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uXGRYQnSCrcyH+F9yOEuNgRG9XtIhtnvZ4uTY5tFr9g=; b=pr+W8aR8VWj9uJ23IxhR810wfctmgLjptq7ii+a3EeL3K3Vg/O/UJNGAykGi+OKwgg Payt3JCsdTAR3HNBNxPSbBsDXS5kd4BhKkXRCJotjCdNcUCkvS3GRq7dUK94Vv0Kw8Fo z0mEiN8yvVoG8z9FTbRRAp2b6y2H/puhCZ15zWeMkGoz402YvDOS+jQttiMBOWLKf4Zd bLM0z4fjcL4wXSuzvSenvqdrTNt90w7AsxBaM/L7XkKKPQ2u3XQ1IFftSplzJRPto1gX ElytyckNlyRtlQh1dZDogpl86eyB1BfZZm6aPsjSYoCHfR8CCa28dwBM+2Jq9LKGOHTU eZoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MKsFTClx; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 36si2748782plc.250.2019.02.14.05.24.35; Thu, 14 Feb 2019 05:24:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b=MKsFTClx; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394723AbfBNNYe (ORCPT + 15 others); Thu, 14 Feb 2019 08:24:34 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:44739 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438860AbfBNNYe (ORCPT ); Thu, 14 Feb 2019 08:24:34 -0500 Received: by mail-lj1-f193.google.com with SMTP id q128so5185612ljb.11 for ; Thu, 14 Feb 2019 05:24:33 -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=uXGRYQnSCrcyH+F9yOEuNgRG9XtIhtnvZ4uTY5tFr9g=; b=MKsFTClxXmNIhKJoqW7Bzaohrn+o+oKrApTMPuAecagVgjpX8DffJkoykZYufVOti5 hm9SeXCgeHTkXCH3ICtTw1Yc9jT2aEoXVYGIj0jFwIH2QXTQopP5nqejv8s8ihmbsqvp kl0D2pq2rWQSkJrteeEwN9XKkfqPuft0McVD91+hw3ukfWDTqthgSQOW/Rz8j0BJNZCO Yom+mJd0aXvkVda10dtoLxbu+ppONatRUeJU4gPIj3Acwu1h7jlGPj4KixiuDKT7MzM1 Z2/7c2Gqp4ngOdZ7JuveLL/ev4epNCv3z28MNwVsmH5vrz4aQUK7GNqAJe2h/8InygBi Pp8A== 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=uXGRYQnSCrcyH+F9yOEuNgRG9XtIhtnvZ4uTY5tFr9g=; b=KoCDgI9ItXtQl0oizettqnUUYQY5/zfNPPRAkF9VoGvOM3NTLWjxIN8Z7aFqYU+dfP oRAsDZfZGtqwyRhspDoBg5OVd0pMJD4fdpRUFdqKhGmPmbkjIh1x5I/jxoRurD0VC/nX KkHiplcKAeYudrLD+ZyKA/ZTDniigLkOFrb+1+miBvJ8P0X9p8Em898+wOwFSAWJHYrP fVimNSbLZLdZoKHpaXRYKf9w9/DCnAAf2nJFbGuMoD1Eh52IVQZi6v3mdLajANx17rlG B9oQx4A2hY7Opq9dkWve6XXHK0P8J9BJpQYL6aCjCM+h32Dh+8QvRkVkoonoucfBpaIZ QQQQ== X-Gm-Message-State: AHQUAuYDKje8t84VgPdTeUOzKF7FZ1dS5AIgkb+1j1dMQDeqvOkpDLwY eVjMwyXP/biDBQeqCC/mosaduA== X-Received: by 2002:a2e:9f49:: with SMTP id v9mr2380399ljk.77.1550150672289; Thu, 14 Feb 2019 05:24:32 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id k13-v6sm427752ljg.84.2019.02.14.05.24.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Feb 2019 05:24:31 -0800 (PST) From: Linus Walleij To: Greg Kroah-Hartman , stable@vger.kernel.org, openwrt-devel@lists.openwrt.org Cc: "David S . Miller" , Eric Dumazet , Liping Zhang , John Youn , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , James Hughes , Felix Fietkau , Matthew Garrett , Linus Walleij Subject: [PATCH 3/8 v3] ch9200: use skb_cow_head() to deal with cloned skbs Date: Thu, 14 Feb 2019 14:23:58 +0100 Message-Id: <20190214132403.10687-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190214132403.10687-1-linus.walleij@linaro.org> References: <20190214132403.10687-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Dumazet commit 6bc6895bdd6744e0136eaa4a11fbdb20a7db4e40 upstream. 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 Signed-off-by: Linus Walleij --- - This was applied upstream in v4.11 - Should be applied to stable v4.9.y --- drivers/net/usb/ch9200.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -- 2.20.1 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);