Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2455614imd; Fri, 2 Nov 2018 11:42:13 -0700 (PDT) X-Google-Smtp-Source: AJdET5dflCdK+4WLTRkD3hz7BG4yyYJ++dJVUXCIBpOhQzRTA5tq6NuhRPgB3zYioOkGfE0utkKf X-Received: by 2002:a17:902:650a:: with SMTP id b10-v6mr12604043plk.36.1541184133518; Fri, 02 Nov 2018 11:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184133; cv=none; d=google.com; s=arc-20160816; b=cCqWW70AWxv/ZOb8tgTAOafFym3YMaW23bEDu5vp2z+IiYVhJwDUBsclbqnQ6Y4SYQ +5rimlXPNquxjY2y8zOu/mlQPR9t1gtFt5PeFHLHXz6sjTEEmraiPMydkL8Dt9P5V2Xy T3CIwCDmYh9tAY9UHAXjrK/vM7WgGmBTCpzj7TlXMXnI1C9b/+Kpuhotrm5fzkEt6C2i clIzPJrz+FOZgfWuv1d9EX3/LWpITBZJV83+YzQMoZn/eazH6JCcrDAU4GK/E2xAchPu AEcwCgLwGJNsMiYDMPAfOR5Pw/M4n+zM53yS3zYOB3p4J8WkavXHfyYKSq2ZLm/i+Oo1 VF6g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+Q99OLDYDLcUm8et2IVdkFdtbdM3sNjZmxYGP5Wb0Rw=; b=AwUZ+HZx2DddJ/ly0csF4a1S+xDKQYp/E6UW++wOeSTBtehUh9YefSNTg5lMHnJ9d7 asKjKQClGTw2C5LzsvAKyCOJ+Shisy4AcpjdBKYG70sibUkaZ9ioqkJMeKw3Vz2C2wZ/ mNeN2w8D83mSqwFZBeO+lPsTi8lfeTknBircPJHm/PUtyKNsDRLHn2xdaLdaRlkpYkhP XC5GyDaYLzMJ0ShkjvvXJf+ZLhRdfUVO3W0oRw4sB7ZlnQPtDo4fr7i1+JZNiwN4zl+J /0PAVvnpvbP3OaTgk7iSniFf5Jw+Ry6enF5uUbJLTsH346SVr/6W6RXicC2NS9hR/ZRd PluQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I6EyhQVC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i20-v6si13499270pgk.562.2018.11.02.11.41.58; Fri, 02 Nov 2018 11:42:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@kernel.org header.s=default header.b=I6EyhQVC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728672AbeKCDsD (ORCPT + 99 others); Fri, 2 Nov 2018 23:48:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:42272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728250AbeKCDsB (ORCPT ); Fri, 2 Nov 2018 23:48:01 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CB65E20837; Fri, 2 Nov 2018 18:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541183990; bh=/niqmERVsMpGaebO5UqYqDGIz/ztJEfl4qpU+6dYtPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I6EyhQVCTRt+lmqHxVaYlm1LrhJfNhElTa/e23krj9jHD3b82HEeff1gwVt2o1Nd6 bxOOy7GWA84GsKvGYEYWsiXwsj9njz0EBLlEpm3b9GWyrrXhXL5NkUkvZI8dMg5Poj 005eL+Zh5rYASPpufip4zfRXDKNL1McQhmlEIy4Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Woojung Huh , "David S. Miller" , Sasha Levin Subject: [PATCH 4.18 044/150] lan78xx: Check for supported Wake-on-LAN modes Date: Fri, 2 Nov 2018 19:33:26 +0100 Message-Id: <20181102182906.485756462@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit eb9ad088f96653a26b340f7c447c44cf023d5cdc ] The driver supports a fair amount of Wake-on-LAN modes, but is not checking that the user specified one that is supported. Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver") Signed-off-by: Florian Fainelli Reviewed-by: Woojung Huh Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/lan78xx.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index aeca484a75b8..2bb3a081ff10 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -1401,19 +1401,10 @@ static int lan78xx_set_wol(struct net_device *netdev, if (ret < 0) return ret; - pdata->wol = 0; - if (wol->wolopts & WAKE_UCAST) - pdata->wol |= WAKE_UCAST; - if (wol->wolopts & WAKE_MCAST) - pdata->wol |= WAKE_MCAST; - if (wol->wolopts & WAKE_BCAST) - pdata->wol |= WAKE_BCAST; - if (wol->wolopts & WAKE_MAGIC) - pdata->wol |= WAKE_MAGIC; - if (wol->wolopts & WAKE_PHY) - pdata->wol |= WAKE_PHY; - if (wol->wolopts & WAKE_ARP) - pdata->wol |= WAKE_ARP; + if (wol->wolopts & ~WAKE_ALL) + return -EINVAL; + + pdata->wol = wol->wolopts; device_set_wakeup_enable(&dev->udev->dev, (bool)wol->wolopts); -- 2.17.1