From patchwork Thu Feb 14 12:49:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 158358 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1324137jaa; Thu, 14 Feb 2019 04:49:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IYzftuoC5I2RqFqblErQBhdl/IF/ikZ2xL8h/RqgsPk84lXPVTEJ7xkS769Cnm63eWy4hUo X-Received: by 2002:a63:fc59:: with SMTP id r25mr3708332pgk.302.1550148575411; Thu, 14 Feb 2019 04:49:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550148575; cv=none; d=google.com; s=arc-20160816; b=X5SiIlclPyRnO70Rc0/Jb9fli2tWMPnTFl+53s7XAUMRvuDXR6M8K7R5iu6Kq0pqWy Aj6SN+/qaw39UdA6NFz86muoSR7LOnYibR3OsaQeja2v3s6bJUN75ex2ogNce7F77An/ q/i+spF9hcHEmP+n/01JCirZBVPllJXcaD3vYbcDqU/Wg85iOpGspHsqRTi3WRYo34Pw wlhdZT2g2k6VsKzZpwRci33DNSgJe3ix8HH+PZ6R49X9p9LpoahBIE6EhPxIJd8Qa7dO /0XlrHZAPgERCMhdAIH0EVEzD920kJD91A0Ryx4xvXzbhXthi37hwtEe0q8fCI6PVqVB u3eA== 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=sAjB2/DdSY6xXUbYOclDGEy9Obo/ZwlYpNFTINvAeew=; b=uWk38wneq9pBCHFdfiMkWAuDCYpBmI4hPamPDa0Bcz8URUGHpfWr4lOMJzCZV6x9RE FF3U0Of72cDvbcfjWb6X8VKBX1m53aBLiSD0lz2zr4W2JgkcrRgBwmz9YcuB6EoR8gSV Rn8eBXKiXOIYDkV27vsUX82LoEdOYQQmcpWKcpCIGmot2YZoqia7rzP8G41O0HVIiQSf hDLWVvUvmGKweqCNlMpe9qBCi++ekx8vRZrf781VyPsmv9FbyOUb9H10XL3qqsBnJXLD fna8N5FmIvcwp+1XCG5vK5b3grpoyYI31BLpotXj9aZS7r3frAdJ8QPrlvvWgMjzGPbr 4eiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JG9ZXx0P; 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 g26si2310745pfi.184.2019.02.14.04.49.35; Thu, 14 Feb 2019 04:49: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=JG9ZXx0P; 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 S2437786AbfBNMte (ORCPT + 15 others); Thu, 14 Feb 2019 07:49:34 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33441 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727958AbfBNMte (ORCPT ); Thu, 14 Feb 2019 07:49:34 -0500 Received: by mail-lj1-f195.google.com with SMTP id f24-v6so5144249ljk.0 for ; Thu, 14 Feb 2019 04:49: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=sAjB2/DdSY6xXUbYOclDGEy9Obo/ZwlYpNFTINvAeew=; b=JG9ZXx0PCIjexNl1Re5fJRUo6JMX4QqvvsZBXXWtCHQgbowAG+AzqJah5ouC75/oCQ epI9+V1L1fgiQfT6EwVbiXQEoWZqSODLstygYwtgzPyHAPkDYQZC83B4w+KNqP5fBBqp zY9zSN/v96B2OzhbOf7EakjIXGymcpubeduzI79Ova8RZji3Q0Ks4LhgoO2w/R9fFR/M 51uddWjqJwCO7ccNoeKW1+N/S/ibEA6R6TsbLqXy89IWMeM2upR35l9uV7wmCa8kJZE2 JIfdezjVMqI8koERjGBtNcWJLVkggAwFCniwd1aSA4UqGM3D96x3350NBE37TQ/5tKz/ WB2A== 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=sAjB2/DdSY6xXUbYOclDGEy9Obo/ZwlYpNFTINvAeew=; b=D8UuV5QqCo2y990BEeB7o6mpCcZ8Lgev9oidMRhuzXXjfY2/m8c8eJXjoa5FErBBHJ Up55vjAf3acHeejXM60sg+4+5jNGL8P/LKq1IdApNwXruNc1anBitmy9w5mXrd2Z4Gfg RG6ayplmieHJH2fZGTkyvN0JIKHOE12N4CgRlm6zAQRrAspgFqD3D3l5Aa8ayYKjbyYK c7RQB55DAWxWZvpNmZXcb2plAp9R/1W/Ske21Ie43l2eVrTRqQOIJjIavi8gGKKmLxCc bLUT5wvNMMQ4SmCVjRN7E3RyryuOBABd1PbyW3mHMTr6PORR1r+0wiziFFY1qJHd6FsN kxBg== X-Gm-Message-State: AHQUAuYwjzqgqKSdoyS02QI2aG+4ckQj1YHGg7FetzoZylgMVfgWSb6k 3wJpssuzkPDlWIYN14rIwqf30w== X-Received: by 2002:a2e:5b11:: with SMTP id p17mr1653086ljb.37.1550148572384; Thu, 14 Feb 2019 04:49:32 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id r7-v6sm410853ljg.85.2019.02.14.04.49.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Feb 2019 04:49: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 , Woojung Huh Subject: [PATCH 2/8 v2] smsc95xx: Use skb_cow_head to deal with cloned skbs Date: Thu, 14 Feb 2019 13:49:04 +0100 Message-Id: <20190214124910.1753-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190214124910.1753-1-linus.walleij@linaro.org> References: <20190214124910.1753-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: James Hughes commit e9156cd26a495a18706e796f02a81fee41ec14f4 upstream. The driver was failing to check that the SKB wasn't cloned before adding checksum data. Replace existing handling to extend/copy the header buffer with skb_cow_head. Signed-off-by: James Hughes Acked-by: Eric Dumazet Acked-by: Woojung Huh Signed-off-by: David S. Miller --- - This was applied upstream in v4.11 - Should be applied to stable v4.9.y --- drivers/net/usb/smsc95xx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index e29f4c0767eb..e719ecd69d01 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -2011,13 +2011,13 @@ static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev, /* We do not advertise SG, so skbs should be already linearized */ BUG_ON(skb_shinfo(skb)->nr_frags); - if (skb_headroom(skb) < overhead) { - struct sk_buff *skb2 = skb_copy_expand(skb, - overhead, 0, flags); + /* Make writable and expand header space by overhead if required */ + if (skb_cow_head(skb, overhead)) { + /* Must deallocate here as returning NULL to indicate error + * means the skb won't be deallocated in the caller. + */ dev_kfree_skb_any(skb); - skb = skb2; - if (!skb) - return NULL; + return NULL; } if (csum) {