From patchwork Thu Feb 14 10:24:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 158333 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1172316jaa; Thu, 14 Feb 2019 02:25:04 -0800 (PST) X-Google-Smtp-Source: AHgI3IaJry4Ru8dlTCsL2I7t0jaEAB3iOM9eLQ+vHTHo3rKXe6oUZ4AVzGSlbCGLwFUHEL+5Rwjs X-Received: by 2002:a62:b248:: with SMTP id x69mr3221126pfe.256.1550139904732; Thu, 14 Feb 2019 02:25:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550139904; cv=none; d=google.com; s=arc-20160816; b=zqNzmJ6nSAuJLsaCil9IA8zQXaTpXLUVAwvvwGSmLG2kqox49ZJ2mtyUOIQ769grAo HnakgpUE1UVwYzOmhWiQAAno6nSMj3Vyfub40Kl3UoDvpSAcKiHnagCjVpoOO9Xr705S 1ELlZVq8rQIutMLggk35jqUwQuBt5u2XEAh21iK8DpneEsf+B+3YGR+mO+R1Bs9/zB2a g5AwXBVdqQa6zYEsiNW5U8Vd6CVRpNhE7jBl7XkAJ2C4g3DZJ8I/4GgJSAZfcuA3Tw4X G2FS37xMHFQfY33InSv34KC3F5eWKyHNqGTIMvReL6b1hX3bQdwJ2tH4gDSf3kdW3hrB NfsQ== 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=QejVeuN9JlqnVwHudfbz2AR9dbAYL9NjcCDz/Vgr3MA=; b=CY8IkdUdEMWyovsY5ROEnh9aLdlZl7dlEUTgJ4eU6W3rhuicXDt0TmKeh6eBPYPXLM U92Ge/Brdb12vkodj9gSoywRnk0ieLNdMmtnvVSKfwmduvayHJFyzScq/8Itj3wrn6QQ x5UGsRIWaRz3JckD3jBrR2FTv3hIVZIJOMS4jdiXfmHpTt+frHX1+9XBYyYq2gc6+B60 A9Mv6wYT0HyoBTCzmbU0/n3WuENWXwPJQ8jqquc1NRjc1LjB50rziEQSq2X+SOaRuzAd TaoPhf9glORPPY4uaCOxM1GPvQ9hPCAJu0WIg2rGeHPSlo8yIAcXZc/pTMfjJh7mqK2U cmQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ZDiaU/ds"; 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 3si2132062plv.258.2019.02.14.02.25.04; Thu, 14 Feb 2019 02:25:04 -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="ZDiaU/ds"; 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 S2388561AbfBNKZE (ORCPT + 15 others); Thu, 14 Feb 2019 05:25:04 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:39061 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387899AbfBNKZD (ORCPT ); Thu, 14 Feb 2019 05:25:03 -0500 Received: by mail-lf1-f68.google.com with SMTP id m11so4131416lfc.6 for ; Thu, 14 Feb 2019 02:25:02 -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=QejVeuN9JlqnVwHudfbz2AR9dbAYL9NjcCDz/Vgr3MA=; b=ZDiaU/dskcTF0g8YrFhWt1RDdiYcqM3R9+07ZwEpexIiQYi8ipgPo+vhFnodkb2bxD 5XfuHIjrfCIzkLWoBOP2QtVOBao9wcQd/0BHOkrWJkpXN+IYO6pw51qRz4n7uFxg7ASl Ts27YZh/bq9AxkRsYWUI34PSi5S5zJrrEsA7+9nCksjHRhpmFXmbLrFl8H884YXYF0v/ Er9NeplRV2q3/DJtF4Y+S2koeiCUW1Vx9DzAXag3B2PYHyWLFylqS/3REAYqa7On/v1f igLl3JNJu0VuR/MeeLagEvDazQBimzwCSLfl7TAfKhGi9yaForQ3xkbBaxEzf73wrUhe YA9A== 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=QejVeuN9JlqnVwHudfbz2AR9dbAYL9NjcCDz/Vgr3MA=; b=BPnszlp/T+aT+SqZ/AaLAhdeiL9jb+4Xtnz+mhlC+Rz+YCroJHeM9WAhpBeiNd/1CB nKg/pKLdHv/BdvRcL0us+S5k6+dmuuWLD/UOhb+hJCVpM97FBD9ieLP4NiGhEwEKCEO4 tIzwvpC+PiZ3ttBUn+JUQC5XZSsyaT3VmGI7NJvuKkP9T/EdueZor8cOLWgcIJvKziqj Me6+m30mYHnLFfkRrMEkWys1uv+NK2a+amaWTfIPSjIbaN2xHJTEOWR2IUjw632kqEIH FwhlUpIouZlDrfdyjebi52I7z/HAAus3KV21k1S2A0kkjn7gB0nhfE6XiXhyyWSGuDrl PdRw== X-Gm-Message-State: AHQUAuZdeHYIzquyu7LooseYoAf8G5TLqwxUM7t6mzNRkJ7fZGoIzyyw fNqj/D4zG+p28cH6EzMgk5AiDQ== X-Received: by 2002:ac2:4215:: with SMTP id y21mr2048953lfh.6.1550139901767; Thu, 14 Feb 2019 02:25:01 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n189sm380392lfn.82.2019.02.14.02.24.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Feb 2019 02:25:00 -0800 (PST) From: Linus Walleij To: Greg Kroah-Hartman , stable@vger.kernel.org, openwrt-devel@lists.openwrt.org Cc: "David S . Miller" , Eric Dumazet , Hauke Mehrtens , Dave Taht , Liping Zhang , John Youn , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , James Hughes , Felix Fietkau , Woojung Huh Subject: [PATCH 02/10] smsc95xx: Use skb_cow_head to deal with cloned skbs Date: Thu, 14 Feb 2019 11:24:28 +0100 Message-Id: <20190214102436.5092-3-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 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: James Hughes 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 --- 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) {