From patchwork Tue May 9 14:42:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 98929 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1857563qge; Tue, 9 May 2017 07:43:33 -0700 (PDT) X-Received: by 10.98.52.4 with SMTP id b4mr317928pfa.124.1494341013536; Tue, 09 May 2017 07:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494341013; cv=none; d=google.com; s=arc-20160816; b=ipsULQNg0Ec40nvujIzuBa0heExaRQ9lrLz6P/xDxR1zuGgXApg43aXEV0AnEWdLJR q3FXGVS8cyNZYgR56Uj+MuOsWlgDbb51OsW1vQQakXVmmn5CEAZ1NuARKsL5RCmKQdQj borZxe75McgcCg226Wdh7Zodcv2piLN4PYgXR8smM9MUzF+vr5lZjrbrRtbSWOexkvdi P5xM18WfDcNhTRdIKvri3xe4zTXd6fjfyMjkp/gO5KJBGRez/DDYEpqctp16vyuazmmu HdxhD5uS8xharOiue0uNzuxV2CL/lc+9xpaNQlVfZVbv3HuTjo9QpKt6HUSMhuMLsMW0 AowQ== 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:arc-authentication-results; bh=B3LvGvUEt85AD9ExLTTRirYGlTUqX1rG7uuHrF6RZkY=; b=GKKbbtTqLCtyhmBMRodKYGs7CdV5XBxGeQG6ISAWZz/eEyCUSJezUJMiA8Cllj4hxG M16JzNdtf1jh4kieJ4gPEcMhmNP31Zr+QlF++NVXVdmxIrVIe7BZW5rr/+Pz5Wnhupkl gNH0cPE+XfNIGJromDyr1hMCHw0R1RTWWleIxGdq5q6I4hlaZQry06sanzy/Efav3GnU QfD/xqd3Gc8sITZzZf1LcFEYDjS2JYk6JfSDqi3OXP0lWPkj49jDpCfeT3KNvPEWaW8L Ne6RutotgZR2mjKB5SWJ/kg9QqIqzCSH97Lgv2u1sy+vY4o+ZUuOhOi2n9pQVaIpdjIc VlyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; 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 h2si99892pli.322.2017.05.09.07.43.33; Tue, 09 May 2017 07:43:33 -0700 (PDT) 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; 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 S1754239AbdEIOnc (ORCPT + 6 others); Tue, 9 May 2017 10:43:32 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:35805 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754236AbdEIOnc (ORCPT ); Tue, 9 May 2017 10:43:32 -0400 Received: by mail-pf0-f181.google.com with SMTP id v14so1169100pfd.2 for ; Tue, 09 May 2017 07:43:32 -0700 (PDT) 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=B3LvGvUEt85AD9ExLTTRirYGlTUqX1rG7uuHrF6RZkY=; b=I5FZMgsuRFERkM6jLxgUg8vInZpizwIuWueA5VhjbgDyRs1p7g1BLTq12RZLI2z8hY eX47ZTiyxqJ2WA3TRScy2zJSHFyec1FKLW/WcKUfZliu0vM3hmsiVYhp69qk1yHSSQUL KiA9Ym12dnbuHed+3DY8sbt/WEo3kYbIT15yY= 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=B3LvGvUEt85AD9ExLTTRirYGlTUqX1rG7uuHrF6RZkY=; b=ABgfW0isJkM+Bgqx5S7QxlTgQg9UgY9vInSHp8Y6TG+tfHYrx3J3YAjc6g57MALgWt u4T+SWtRvldj4h4UiD1+T3FH28ZGbR4F7jNlMzbuDRHNqrRr3BFxyEgy5LMsN6TR/jP6 YtF8ADhtRUkZXBthp9GkVWoBj7TT3w9okg8QJRrzplIdNtmDWxUlhqbeapSerHl+5j6/ obtnU7kLnKhEQzwccwpsjAhkNbsIPJ98XXCDqQ8db0ZBAtixXuyMcHEAz1CvRxnXZohU ZV4MDNEZ1ufIro9xni+NacAjSpIwii8chucOTtOgnFG5VPYLd5Y9KK2g+49c2evGjWX0 V6Yg== X-Gm-Message-State: AODbwcD+PzPgWWHorxaaEsVc6Md94sfPDSlNlVf8w4LkUPgJyFatfGlT dn0XEw0XT0A3qkt5 X-Received: by 10.99.160.68 with SMTP id u4mr517605pgn.39.1494341011490; Tue, 09 May 2017 07:43:31 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.126]) by smtp.gmail.com with ESMTPSA id 11sm341811pfj.59.2017.05.09.07.43.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 May 2017 07:43:30 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: stable@vger.kernel.org, =?utf-8?q?Bj=C3=B8rn_Mork?= , "David S . Miller" Subject: [PATCH for-3.18 16/24] cdc_ncm: do not call usbnet_link_change from cdc_ncm_bind Date: Tue, 9 May 2017 20:12:40 +0530 Message-Id: <1494340968-17152-17-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494340968-17152-1-git-send-email-amit.pundir@linaro.org> References: <1494340968-17152-1-git-send-email-amit.pundir@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bjørn Mork commit 4d06dd537f95683aba3651098ae288b7cbff8274 upstream. usbnet_link_change will call schedule_work and should be avoided if bind is failing. Otherwise we will end up with scheduled work referring to a netdev which has gone away. Instead of making the call conditional, we can just defer it to usbnet_probe, using the driver_info flag made for this purpose. Fixes: 8a34b0ae8778 ("usbnet: cdc_ncm: apply usbnet_link_change") Reported-by: Andrey Konovalov Suggested-by: Linus Torvalds Signed-off-by: Bjørn Mork Signed-off-by: David S. Miller Signed-off-by: Amit Pundir --- drivers/net/usb/cdc_ncm.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) -- 2.7.4 diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 614b4ca6420a..02e7b9e6a641 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -952,23 +952,12 @@ EXPORT_SYMBOL_GPL(cdc_ncm_select_altsetting); static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) { - int ret; - /* MBIM backwards compatible function? */ if (cdc_ncm_select_altsetting(intf) != CDC_NCM_COMM_ALTSETTING_NCM) return -ENODEV; /* The NCM data altsetting is fixed */ - ret = cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM); - - /* - * We should get an event when network connection is "connected" or - * "disconnected". Set network connection in "disconnected" state - * (carrier is OFF) during attach, so the IP network stack does not - * start IPv6 negotiation and more. - */ - usbnet_link_change(dev, 0, 0); - return ret; + return cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM); } static void cdc_ncm_align_tail(struct sk_buff *skb, size_t modulus, size_t remainder, size_t max) @@ -1510,7 +1499,8 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb) static const struct driver_info cdc_ncm_info = { .description = "CDC NCM", - .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET, + .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET + | FLAG_LINK_INTR, .bind = cdc_ncm_bind, .unbind = cdc_ncm_unbind, .manage_power = usbnet_manage_power, @@ -1523,7 +1513,7 @@ static const struct driver_info cdc_ncm_info = { static const struct driver_info wwan_info = { .description = "Mobile Broadband Network Device", .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET - | FLAG_WWAN, + | FLAG_LINK_INTR | FLAG_WWAN, .bind = cdc_ncm_bind, .unbind = cdc_ncm_unbind, .manage_power = usbnet_manage_power, @@ -1536,7 +1526,7 @@ static const struct driver_info wwan_info = { static const struct driver_info wwan_noarp_info = { .description = "Mobile Broadband Network Device (NO ARP)", .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET - | FLAG_WWAN | FLAG_NOARP, + | FLAG_LINK_INTR | FLAG_WWAN | FLAG_NOARP, .bind = cdc_ncm_bind, .unbind = cdc_ncm_unbind, .manage_power = usbnet_manage_power,