From patchwork Wed Dec 13 01:57:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 121717 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4919654qgn; Tue, 12 Dec 2017 18:44:25 -0800 (PST) X-Google-Smtp-Source: ACJfBou+vME7B8H3Chep1fUhK84rNVggPHMFRayxp4fzDsiaqWFkI0KsXEkEgKNKn8nr+KNOKdZk X-Received: by 10.84.238.136 with SMTP id v8mr4355281plk.381.1513133065567; Tue, 12 Dec 2017 18:44:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513133065; cv=none; d=google.com; s=arc-20160816; b=Ro7aUskbJ7fHL/xTNM2TkevUDPw63NVIzDJ7odxS/uXrw5uVMRlGUbcqTRak0+fXhX K7K+lCQT7h4u4zrtI3+ZEb5WVgzkSfq6b2K2p+M5GS24u1NiEvToA5g9u+xhcVxevcds ob6JX20AnhXvivBddEKKwT5Ys85XqGH3qKJAOdccV/3ZcMUq5290bDp2wwCXzLtieYP9 p8SKil4fV9uP1CBH6wEJrxcGL5Ct4vsTN/5++gDGidF8DgYvW/E1SpnuvtN6jXKtU7St 5v1msyx1qLopfhWo0YkVh1gpSfSfWPs34JdufGsUwjAbYFhKgKrxklM1x7ADqd0UeouW k+wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:cc:from:dkim-signature :dkim-signature:dkim-signature:arc-authentication-results; bh=VKcUfz1ia4idFefQJWoqYNcdD2GkcOFdjbdLY19FhQU=; b=uaRvW2IR4n6nlZOQG5ioaHYM5tJcAuudc5/6r0RyaafudyyGQxFU/kfR2wN+pZevWd El8+NBD+Ocjq3nObqF03zRqrWog3wA8n36n2QfUdgdmz78QR7pB7eySJKrVa+4D7xone Nc3tNt9L/keWvc0g27D7H9sybcpagmavDIXdQzSeQEyRJNQ56b+xJ6hzBZVoctmVa/i0 A8B2a23Nk0alvlKkXj3N/zx8Q7WCbQC/AGNJ5ryRREXxsWMFWeDXNQqRsQ/PKgNio9or f+xNc1Du0WOWoC4EhZmMkJTQTKKisUmZ8PL2Sh6qkoYrofpUvV/86wnCuCtNb/YEkjwJ BhAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=nCYNjTIM; dkim=fail header.i=@verizon.com header.s=corp header.b=eyFoK/b2; dkim=fail header.i=@verizon.com header.s=corp header.b=GukzqGHV; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12si527666plj.70.2017.12.12.18.44.25; Tue, 12 Dec 2017 18:44:25 -0800 (PST) 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=fail header.i=@verizon.com header.s=corp header.b=nCYNjTIM; dkim=fail header.i=@verizon.com header.s=corp header.b=eyFoK/b2; dkim=fail header.i=@verizon.com header.s=corp header.b=GukzqGHV; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753393AbdLMCoS (ORCPT + 10 others); Tue, 12 Dec 2017 21:44:18 -0500 Received: from omzsmtpe03.verizonbusiness.com ([199.249.25.208]:6490 "EHLO omzsmtpe03.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752273AbdLMB6O (ORCPT ); Tue, 12 Dec 2017 20:58:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130294; x=1544666294; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=heb6R2cmPQc+YGUc/+76JrfPTAdHAoRZI990hDokSHs=; b=nCYNjTIM5DKUVTWprNpUotQpzVz6mTgoZv4t0Ght4E/BLhSICOkqYwuv vPB/TkDc2QqtvMFGIwAorRhBqbPryWhTsRJ7DNL8Gy+c/jlHOlNO+DCCu c8/HyvAy76/NJKQkDusXZJjbyjEZi6J/u5wruLH5fCipir/c2OjAQmBWl 4=; Received: from unknown (HELO fldsmtpi02.verizon.com) ([166.68.71.144]) by omzsmtpe03.verizonbusiness.com with ESMTP; 13 Dec 2017 01:58:06 +0000 Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO atlantis.verizonwireless.com) ([10.255.192.101]) by fldsmtpi02.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Dec 2017 01:57:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130256; x=1544666256; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=heb6R2cmPQc+YGUc/+76JrfPTAdHAoRZI990hDokSHs=; b=eyFoK/b24XysV3mhrvY1bBvkvSe0ees3Np9zA4QMgVxbQuegLM/AnuAq mPhoxiPP/4amWfzNRc6bc902zsPyXeLKQ0EAlfy29JfbLCIgfXV6fbhbt jDQirjtNF2abJcAP4VLq6VfWrLrgPwldi4MJ2dTIckTyV/vtyloNGXb2H U=; Received: from mariner.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.84]) by atlantis.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Dec 2017 20:57:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130256; x=1544666256; h=to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:from:cc; bh=heb6R2cmPQc+YGUc/+76JrfPTAdHAoRZI990hDokSHs=; b=GukzqGHVFLxzyWnyRWk8jzKr0jeFvwUF9as3HajQzF/J0Hn3GHfOOWHj H3E7aDnz7+hGiAPiOTP/wJTp2MEB9BR+ZSmlNGipxDgyQGQrtDbzjT8KC H7gePiDFyYo8rhOnZZggpT/RwB6viiz58VFrPksw7FkNhy6AnWsqN0tOd g=; From: alexander.levin@verizon.com Cc: Arnd Bergmann , Guenter Roeck , alexander.levin@verizon.com X-Host: mariner.tdc.vzwcorp.com Received: from ohtwi1exh002.uswin.ad.vzwcorp.com ([10.144.218.44]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 13 Dec 2017 01:57:36 +0000 Received: from OHTWI1EXO910.uswin.ad.vzwcorp.com (10.144.218.210) by OHTWI1EXH002.uswin.ad.vzwcorp.com (10.144.218.44) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 12 Dec 2017 20:57:36 -0500 Received: from OMZP1LUMXCA19.uswin.ad.vzwcorp.com (144.8.22.197) by OHTWI1EXO910.uswin.ad.vzwcorp.com (10.144.218.210) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 20:57:35 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA19.uswin.ad.vzwcorp.com (144.8.22.197) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 19:57:34 -0600 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Tue, 12 Dec 2017 19:57:34 -0600 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 035/100] hwmon: (asus_atk0110) fix uninitialized data access Thread-Topic: [PATCH AUTOSEL for 4.9 035/100] hwmon: (asus_atk0110) fix uninitialized data access Thread-Index: AQHTc7W8kAHANXYFy0iEjm9S2z+iPQ== Date: Wed, 13 Dec 2017 01:57:31 +0000 Message-ID: <20171213015722.6722-10-alexander.levin@verizon.com> References: <20171213015722.6722-1-alexander.levin@verizon.com> In-Reply-To: <20171213015722.6722-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit a2125d02443e9a4e68bcfd9f8004fa23239e8329 ] The latest gcc-7 snapshot adds a warning to point out that when atk_read_value_old or atk_read_value_new fails, we copy uninitialized data into sensor->cached_value: drivers/hwmon/asus_atk0110.c: In function 'atk_input_show': drivers/hwmon/asus_atk0110.c:651:26: error: 'value' may be used uninitialized in this function [-Werror=maybe-uninitialized] Adding an error check avoids this. All versions of the driver are affected. Fixes: 2c03d07ad54d ("hwmon: Add Asus ATK0110 support") Signed-off-by: Arnd Bergmann Reviewed-by: Luca Tettamanti Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/asus_atk0110.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.11.0 diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c index cccef87963e0..975c43d446f8 100644 --- a/drivers/hwmon/asus_atk0110.c +++ b/drivers/hwmon/asus_atk0110.c @@ -646,6 +646,9 @@ static int atk_read_value(struct atk_sensor_data *sensor, u64 *value) else err = atk_read_value_new(sensor, value); + if (err) + return err; + sensor->is_valid = true; sensor->last_updated = jiffies; sensor->cached_value = *value; From patchwork Wed Dec 13 01:57:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 121715 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4918400qgn; Tue, 12 Dec 2017 18:42:40 -0800 (PST) X-Google-Smtp-Source: ACJfBovQc0s2PgHiZOLFmPqQaDoBSLhVFUVDeUFAJX8CSV7d5MLvllKKrfJlnq+3j+ql4oWNGpII X-Received: by 10.98.58.208 with SMTP id v77mr4460111pfj.150.1513132960211; Tue, 12 Dec 2017 18:42:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513132960; cv=none; d=google.com; s=arc-20160816; b=FNmqRFr37IusVCEqwS7XsVtyOLgLESsq0ELbxqkI6OShEd8tk/fsk/4b0ahYfn1BCi U5AGjrE1E8vihlO+YWKcUUA+6yy9PrSUlQWzzEGQBeNvM7Ubgc8Jwj4D56exobE/390X BiFMlQ4ghU0f5eB3Nch85xA1wY3wJsZHRjtPfPoY7T/F5duQO1vIG9+yE9QGVN/BQ4wO F2Tp5r3Rd5ICObbnVIVCBOjfPI61sAte1/cBMaF04qny5BuWrkxcfgq73AEHUmW203Rr +u69dtvjzIW42kQ/awlKBZhuIT82oOSTO+XMYzM5HMX0L1uVfBpNkeqFL5zQoejmXm1L DhQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:cc:from:dkim-signature :dkim-signature:dkim-signature:arc-authentication-results; bh=WAJGm+Iup1+AYy1oyptKTKMcbqWrP641kbpW5aNRY5w=; b=uucP4PHkMAXIyQeNfaz6kpFEMNX2t4tpTxUbvmaVRZXT/MQDpRePsPaXLQcblyevn+ /UCW7SZuIheev29hNair1+RO5p4LMeei3tcr17GP5Vl+Mic3n4KgHa+I5ZFNGJNK+UYC c5iJLqClHpoyGuDMbWR0iS17J0T4A2Z+96ymy3jyPX6nqEr9uBBae6puWuiHAoGk5DrO xGLBw2wjofDu+IfAcwUHDRsDZCZqFKUBW6Su9hMPZUVwPAaQXEmgWg+e2zgSzA+cgAOc D/7RQFpTumUOsXSCLNhLZHTxreMHYgbJ8fKjmzCL5u4833KgioVsFb0mvdSl7DN20WGx ksuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=gpcfOHfz; dkim=fail header.i=@verizon.com header.s=corp header.b=i4qciamy; dkim=fail header.i=@verizon.com header.s=corp header.b=BXTCOFNG; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si446058pgq.658.2017.12.12.18.42.39; Tue, 12 Dec 2017 18:42:40 -0800 (PST) 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=fail header.i=@verizon.com header.s=corp header.b=gpcfOHfz; dkim=fail header.i=@verizon.com header.s=corp header.b=i4qciamy; dkim=fail header.i=@verizon.com header.s=corp header.b=BXTCOFNG; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753225AbdLMCmc (ORCPT + 10 others); Tue, 12 Dec 2017 21:42:32 -0500 Received: from omzsmtpe03.verizonbusiness.com ([199.249.25.208]:32009 "EHLO omzsmtpe03.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753153AbdLMB6U (ORCPT ); Tue, 12 Dec 2017 20:58:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130300; x=1544666300; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=kyfTk0xptnKovUAbh25eW8Z3YBWwMC5k3zkFKFOIBo4=; b=gpcfOHfzhnONF5XYQ0Z89gJxbrDTz5UHk51u4j2kwiZBETw/O8ap/PaN 3CEFdn7VBWkMoqnK85R+bDi4jKBXFAS2x+4aL+wHgo7FY3apFPUWNV92h O1ZrvUixCsw3pfGHfEZZSyS4wKjqHTLwZMVsg9tr6hozIMsgw9FU6Nhpp M=; Received: from unknown (HELO fldsmtpi02.verizon.com) ([166.68.71.144]) by omzsmtpe03.verizonbusiness.com with ESMTP; 13 Dec 2017 01:58:06 +0000 Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO apollo.verizonwireless.com) ([10.255.192.101]) by fldsmtpi02.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Dec 2017 01:57:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130260; x=1544666260; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=kyfTk0xptnKovUAbh25eW8Z3YBWwMC5k3zkFKFOIBo4=; b=i4qciamyLg4SGmpMlmXrxb/R3mwOJRu+ettsvxRTOLOhTfs+Kq3bq7om KBqvW35Iy8DCk7AoTmVfkwWOpjl1i75z9QmWyElgb0+Q+M9EjIp8GGItv hvKobuoXntlCXwjglTgnTA419CdAiYg93SJeTnOVCzaGrc5Qp1NGtFYZu I=; Received: from mariner.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.84]) by apollo.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Dec 2017 20:57:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130260; x=1544666260; h=to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:from:cc; bh=kyfTk0xptnKovUAbh25eW8Z3YBWwMC5k3zkFKFOIBo4=; b=BXTCOFNGitxK+sbR8HIowX4oHh7xi43VZ+82Jzksec2iw+JlN7JIBPqc PSnEWEAcsbngR/7ttQScF8QC8na6iD8GB3fjEMI4g28AzejMQpfl0WwMT wPYJhPIp5ZGv8+1trU8A8n6cSH7UcFralCSKGSGuiFyYRlb54L0Fl5Z4Y Y=; From: alexander.levin@verizon.com Cc: Arnd Bergmann , "David S . Miller" , alexander.levin@verizon.com X-Host: mariner.tdc.vzwcorp.com Received: from ohtwi1exh001.uswin.ad.vzwcorp.com ([10.144.218.43]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 13 Dec 2017 01:57:40 +0000 Received: from tbwexch10apd.uswin.ad.vzwcorp.com (153.114.162.34) by OHTWI1EXH001.uswin.ad.vzwcorp.com (10.144.218.43) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 12 Dec 2017 20:57:40 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by tbwexch10apd.uswin.ad.vzwcorp.com (153.114.162.34) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 20:57:39 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 19:57:39 -0600 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Tue, 12 Dec 2017 19:57:39 -0600 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 042/100] bna: avoid writing uninitialized data into hw registers Thread-Topic: [PATCH AUTOSEL for 4.9 042/100] bna: avoid writing uninitialized data into hw registers Thread-Index: AQHTc7W9eEz4ptLFFUqd+0KPb9YjDQ== Date: Wed, 13 Dec 2017 01:57:33 +0000 Message-ID: <20171213015722.6722-17-alexander.levin@verizon.com> References: <20171213015722.6722-1-alexander.levin@verizon.com> In-Reply-To: <20171213015722.6722-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit a5af83925363eb85d467933e3d6ec5a87001eb7c ] The latest gcc-7 snapshot warns about bfa_ioc_send_enable/bfa_ioc_send_disable writing undefined values into the hardware registers: drivers/net/ethernet/brocade/bna/bfa_ioc.c: In function 'bfa_iocpf_sm_disabling_entry': arch/arm/include/asm/io.h:109:22: error: '*((void *)&disable_req+4)' is used uninitialized in this function [-Werror=uninitialized] arch/arm/include/asm/io.h:109:22: error: '*((void *)&disable_req+8)' is used uninitialized in this function [-Werror=uninitialized] The two functions look like they should do the same thing, but only one of them initializes the time stamp and clscode field. The fact that we only get a warning for one of the two functions seems to be arbitrary, based on the inlining decisions in the compiler. To address this, I'm making both functions do the same thing: - set the clscode from the ioc structure in both - set the time stamp from ktime_get_real_seconds (which also avoids the signed-integer overflow in 2038 and extends the well-defined behavior until 2106). - zero-fill the reserved field Fixes: 8b230ed8ec96 ("bna: Brocade 10Gb Ethernet device driver") Signed-off-by: Arnd Bergmann Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/brocade/bna/bfa_ioc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 9e59663a6ead..0f6811860ad5 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c @@ -1930,13 +1930,13 @@ static void bfa_ioc_send_enable(struct bfa_ioc *ioc) { struct bfi_ioc_ctrl_req enable_req; - struct timeval tv; bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ, bfa_ioc_portid(ioc)); enable_req.clscode = htons(ioc->clscode); - do_gettimeofday(&tv); - enable_req.tv_sec = ntohl(tv.tv_sec); + enable_req.rsvd = htons(0); + /* overflow in 2106 */ + enable_req.tv_sec = ntohl(ktime_get_real_seconds()); bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req)); } @@ -1947,6 +1947,10 @@ bfa_ioc_send_disable(struct bfa_ioc *ioc) bfi_h2i_set(disable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_DISABLE_REQ, bfa_ioc_portid(ioc)); + disable_req.clscode = htons(ioc->clscode); + disable_req.rsvd = htons(0); + /* overflow in 2106 */ + disable_req.tv_sec = ntohl(ktime_get_real_seconds()); bfa_ioc_mbox_send(ioc, &disable_req, sizeof(struct bfi_ioc_ctrl_req)); } From patchwork Wed Dec 13 01:57:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 121714 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4914201qgn; Tue, 12 Dec 2017 18:37:13 -0800 (PST) X-Google-Smtp-Source: ACJfBosVcm4uSNo5GWSdSnRwDBIwnHlgMASkbEDjWu/o4WK3Zo1ZKzZkFID6l2ndJs0ABpEp/QL5 X-Received: by 10.99.191.1 with SMTP id v1mr3888858pgf.93.1513132633217; Tue, 12 Dec 2017 18:37:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513132633; cv=none; d=google.com; s=arc-20160816; b=gELMFparRyRa6DuhqfStagdj/TuvyqnlEfSAYkJEevChspNXF+8CGqvYykcHK92y45 pKeSlQhVjhXwKv7WqFai1+PmR3rHANTqH4uScFzodOBrs7Dy74wTIphDf8wYT1UiGcXs 0L/kTrLV6gsUHjcmNDcvtWQCfuDHAPNlCcroF6YwtZbGMjFVYRWK/rzE9BjOw22vrWlI 7hjUGbVe5RUZMTkFT0YNOA4UUFUFjl9U0ixagr1+2KwMo4xrIQqHkvcMxDpCsKYMs1Ag n47sH/yZFDo9M9C7iR160QoJL3ML5yFwK3ymxaefDYmnwEJZK5IHMXXOkWakF7KeFrow 6jmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:cc:from:dkim-signature :dkim-signature:dkim-signature:arc-authentication-results; bh=692Nbh3VJMWEBp6cX/tx2q/gkf6bqu5Aw1zuKLK/7L8=; b=mB6yjAp0KFL6WTlv6Sy22xrHfc6a3AwGkRCg0tam3FozwPtn2lRrZsKkQ5cikUy6iJ byYp3NrzPxutZFa1I/d1KYmafA1imXnriSQcrawXdnbmZHmWPzzvhPbvWfQkqEgwehGk LCZ9Y9nINPUqd5i0tTfm8iZtVS8/EYu+GqW8BKJDUyaoMDnQ4awQHdldycHLfVJS738e 9E2UIPuanDjfYvPWJ2eejtSx7JdK+1Q+VJEPPOJxDuVOqJKr3oRVgaE9/K72elj2a5+j neQH/+wbP6tlpz5Ss9lGH1jDIp3GzNLCGmiL2mk7p9/iIsxdY6r9TRK0JjADgv5t3BOI sziw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=D0z56k34; dkim=fail header.i=@verizon.com header.s=corp header.b=IpIS93Jq; dkim=fail header.i=@verizon.com header.s=corp header.b=REY3fKmz; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a72si441557pge.529.2017.12.12.18.37.12; Tue, 12 Dec 2017 18:37:13 -0800 (PST) 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=fail header.i=@verizon.com header.s=corp header.b=D0z56k34; dkim=fail header.i=@verizon.com header.s=corp header.b=IpIS93Jq; dkim=fail header.i=@verizon.com header.s=corp header.b=REY3fKmz; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753605AbdLMChJ (ORCPT + 10 others); Tue, 12 Dec 2017 21:37:09 -0500 Received: from fldsmtpe03.verizon.com ([140.108.26.142]:44470 "EHLO fldsmtpe03.verizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753299AbdLMB7E (ORCPT ); Tue, 12 Dec 2017 20:59:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130344; x=1544666344; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=puTFqryI5b4n9GRvYzBBc8TC4lwpCT0Qf7ZqA8jbFtQ=; b=D0z56k34zjFSYdA9DUgNADhcpt2dw3udWeN0Y1U6olHa82mvAFmyNW3r jHdDaha+lC1nKFculjign3+6+BTnCG90P/OLX9bIPHCMs3zCkX9IimJ8r MFaq8wDx1MOBKo18GwqJ5Vm+p9Kie1ENmbGUH8ONzSkKUy5kG3QmFB9fa M=; Received: from unknown (HELO fldsmtpi01.verizon.com) ([166.68.71.143]) by fldsmtpe03.verizon.com with ESMTP; 13 Dec 2017 01:58:57 +0000 Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO atlantis.verizonwireless.com) ([10.255.192.101]) by fldsmtpi01.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Dec 2017 01:58:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130300; x=1544666300; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=puTFqryI5b4n9GRvYzBBc8TC4lwpCT0Qf7ZqA8jbFtQ=; b=IpIS93Jqp2W8RX+DRep/SDUjYRr9kZeFvMyOVlD9R3FvGp3qgLS7VvZa S6H1Gx/gqXnY+ppiIHAQRcrCm6ey0DG5kvGNc0zadiIu+RD9V72fgmEqa 0gI6p8BndiQWYkUrsphcVydXFi3umUkHLz4nPpGyasspvsGcxaYKaf+BS U=; Received: from surveyor.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.83]) by atlantis.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Dec 2017 20:58:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130300; x=1544666300; h=to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:from:cc; bh=puTFqryI5b4n9GRvYzBBc8TC4lwpCT0Qf7ZqA8jbFtQ=; b=REY3fKmzEUm+rxAoQYI9pdaPcN1jVhq04G4RjyxsxXlmwoNZNhNxZSjQ iNA1vn+DTYNX/MiQw6rX9wqv0e4DF1OMXcpHbkt/Qvg278sd3fUNg2KIq 0CMx1lk/JRCWS31n+b+Ed57jrV1NBdkIMlDNuIN45g/iam0o7GhK33X0e Q=; From: alexander.levin@verizon.com Cc: Mark Rutland , Alexey Kuznetsov , "David S . Miller" , "Hideaki YOSHIFUJI" , James Morris , Patrick McHardy , "netdev@vger.kernel.org" , alexander.levin@verizon.com X-Host: surveyor.tdc.vzwcorp.com Received: from ohtwi1exh002.uswin.ad.vzwcorp.com ([10.144.218.44]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 13 Dec 2017 01:58:19 +0000 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OHTWI1EXH002.uswin.ad.vzwcorp.com (10.144.218.44) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 12 Dec 2017 20:58:19 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 19:58:18 -0600 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Tue, 12 Dec 2017 19:58:18 -0600 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 057/100] net: ipconfig: fix ic_close_devs() use-after-free Thread-Topic: [PATCH AUTOSEL for 4.9 057/100] net: ipconfig: fix ic_close_devs() use-after-free Thread-Index: AQHTc7W/5FHLqLUa0kGlm9x5J8SnHg== Date: Wed, 13 Dec 2017 01:57:36 +0000 Message-ID: <20171213015722.6722-32-alexander.levin@verizon.com> References: <20171213015722.6722-1-alexander.levin@verizon.com> In-Reply-To: <20171213015722.6722-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Rutland [ Upstream commit ffefb6f4d6ad699a2b5484241bc46745a53235d0 ] Our chosen ic_dev may be anywhere in our list of ic_devs, and we may free it before attempting to close others. When we compare d->dev and ic_dev->dev, we're potentially dereferencing memory returned to the allocator. This causes KASAN to scream for each subsequent ic_dev we check. As there's a 1-1 mapping between ic_devs and netdevs, we can instead compare d and ic_dev directly, which implicitly handles the !ic_dev case, and avoids the use-after-free. The ic_dev pointer may be stale, but we will not dereference it. Original splat: [ 6.487446] ================================================================== [ 6.494693] BUG: KASAN: use-after-free in ic_close_devs+0xc4/0x154 at addr ffff800367efa708 [ 6.503013] Read of size 8 by task swapper/0/1 [ 6.507452] CPU: 5 PID: 1 Comm: swapper/0 Not tainted 4.11.0-rc3-00002-gda42158 #8 [ 6.514993] Hardware name: AppliedMicro Mustang/Mustang, BIOS 3.05.05-beta_rc Jan 27 2016 [ 6.523138] Call trace: [ 6.525590] [] dump_backtrace+0x0/0x570 [ 6.530976] [] show_stack+0x20/0x30 [ 6.536017] [] dump_stack+0x120/0x188 [ 6.541231] [] kasan_object_err+0x24/0xa0 [ 6.546790] [] kasan_report_error+0x244/0x738 [ 6.552695] [] __asan_report_load8_noabort+0x54/0x80 [ 6.559204] [] ic_close_devs+0xc4/0x154 [ 6.564590] [] ip_auto_config+0x2ed4/0x2f1c [ 6.570321] [] do_one_initcall+0xcc/0x370 [ 6.575882] [] kernel_init_freeable+0x5f8/0x6c4 [ 6.581959] [] kernel_init+0x18/0x190 [ 6.587171] [] ret_from_fork+0x10/0x40 [ 6.592468] Object at ffff800367efa700, in cache kmalloc-128 size: 128 [ 6.598969] Allocated: [ 6.601324] PID = 1 [ 6.603427] save_stack_trace_tsk+0x0/0x418 [ 6.607603] save_stack_trace+0x20/0x30 [ 6.611430] kasan_kmalloc+0xd8/0x188 [ 6.615087] ip_auto_config+0x8c4/0x2f1c [ 6.619002] do_one_initcall+0xcc/0x370 [ 6.622832] kernel_init_freeable+0x5f8/0x6c4 [ 6.627178] kernel_init+0x18/0x190 [ 6.630660] ret_from_fork+0x10/0x40 [ 6.634223] Freed: [ 6.636233] PID = 1 [ 6.638334] save_stack_trace_tsk+0x0/0x418 [ 6.642510] save_stack_trace+0x20/0x30 [ 6.646337] kasan_slab_free+0x88/0x178 [ 6.650167] kfree+0xb8/0x478 [ 6.653131] ic_close_devs+0x130/0x154 [ 6.656875] ip_auto_config+0x2ed4/0x2f1c [ 6.660875] do_one_initcall+0xcc/0x370 [ 6.664705] kernel_init_freeable+0x5f8/0x6c4 [ 6.669051] kernel_init+0x18/0x190 [ 6.672534] ret_from_fork+0x10/0x40 [ 6.676098] Memory state around the buggy address: [ 6.680880] ffff800367efa600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 6.688078] ffff800367efa680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 6.695276] >ffff800367efa700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 6.702469] ^ [ 6.705952] ffff800367efa780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 6.713149] ffff800367efa800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 6.720343] ================================================================== [ 6.727536] Disabling lock debugging due to kernel taint Signed-off-by: Mark Rutland Cc: Alexey Kuznetsov Cc: David S. Miller Cc: Hideaki YOSHIFUJI Cc: James Morris Cc: Patrick McHardy Cc: netdev@vger.kernel.org Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/ipconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 071a785c65eb..b23464d9c538 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -306,7 +306,7 @@ static void __init ic_close_devs(void) while ((d = next)) { next = d->next; dev = d->dev; - if ((!ic_dev || dev != ic_dev->dev) && !netdev_uses_dsa(dev)) { + if (d != ic_dev && !netdev_uses_dsa(dev)) { pr_debug("IP-Config: Downing %s\n", dev->name); dev_change_flags(dev, d->flags); } From patchwork Wed Dec 13 01:57:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 121699 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4883894qgn; Tue, 12 Dec 2017 18:00:00 -0800 (PST) X-Google-Smtp-Source: ACJfBottvuL9WHFmTGwbRS2kopAIbDqjCbr6ajVqtdyxebdJQFuNugEDMK38mDJefMZhURsYfNqW X-Received: by 10.159.211.71 with SMTP id g7mr4124983plp.15.1513130400293; Tue, 12 Dec 2017 18:00:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513130400; cv=none; d=google.com; s=arc-20160816; b=rtHyP8v62wohQ9+BLKJIpKYsCcQszs3SqYmytQxVRQyLrKl7k1jW9d+qdyQU82i64i 13daJHTNlcLdHK4rCtFyk3iRKBw4LPWsWSxf9G3OXsI6BI1iW0jhvWFz0P7UpUs83y4d GhajnX4nAS4boNkcXsLNrjcUvC20RlsJdAuKzHzCHhBzxv3MvAgv0lGiRyFr0W1gOKTz fcUjZ6zX99M7YnLQV/H05FPraS08Uod4SFKheZs9AovVSl/S83LgxBHm3GS1W29/5BsM XGe7KJsWp6/G9q0Iq0n6XsuFOQ700ktUqwOWksYUK6hEVId3x4h38Xvu9U201EWmpsWC scAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:cc:from:dkim-signature :dkim-signature:dkim-signature:arc-authentication-results; bh=k3zNENSR3egsyKBqwhFmA5T70lslVGW/0/i8FKIoi8I=; b=A8G5FsUitpo51+OgDQO8rIJ4W39IG08RO230r5u3jVv/kPVAqEjX+hJ9IXK731WtdH tdTgIlcVOwCtZANVON0GuYD2n6klSmF8L8wLeZvBfRTOALwdOzJaDcWsJeQ7jiO097Af TL0mWvS5qHwbANyPBAm1WE8yodyEvCpjb/ah+Iba0MO/1n0f+eWAD6fO/flECTCY9zVr A2HXUyuGFRPt+dosxiGDMa/tlX7Ktomrj7/CFPC4nJ8B3OXDaP7GjJ+LxOjAqAwFzmc5 JULMj5y/97QPlT217wG23JQpx4oiIkbqL+N+fMnxlmrL0iERjN7268LR+zdj7Q/R2aIC NgjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=UukdxWsA; dkim=fail header.i=@verizon.com header.s=corp header.b=SJRT3Ipi; dkim=fail header.i=@verizon.com header.s=corp header.b=aIAc4fza; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si425190pls.157.2017.12.12.18.00.00; Tue, 12 Dec 2017 18:00:00 -0800 (PST) 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=fail header.i=@verizon.com header.s=corp header.b=UukdxWsA; dkim=fail header.i=@verizon.com header.s=corp header.b=SJRT3Ipi; dkim=fail header.i=@verizon.com header.s=corp header.b=aIAc4fza; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753452AbdLMB7z (ORCPT + 11 others); Tue, 12 Dec 2017 20:59:55 -0500 Received: from fldsmtpe03.verizon.com ([140.108.26.142]:44470 "EHLO fldsmtpe03.verizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753279AbdLMB66 (ORCPT ); Tue, 12 Dec 2017 20:58:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130338; x=1544666338; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Hnw7FF586JVESdHiTXDCj8NCrqzvap2aOHnQ+bhr50E=; b=UukdxWsAoEFHPY7ucNAU/ophymLXupnpPcyCdaMffvG2kseSc45kmM/W oBXDtgtasvWJvyGkJV/s5rRfRlVW9iEFn3ZGud2Tco8UmXYJIBo+8rmLb fzRiL+2ru8oN7VJZdmiKhEWHDrZIftezBGfB9aUDGSDBl6uPhXQ8rv+lO s=; Received: from unknown (HELO fldsmtpi01.verizon.com) ([166.68.71.143]) by fldsmtpe03.verizon.com with ESMTP; 13 Dec 2017 01:58:57 +0000 Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO atlantis.verizonwireless.com) ([10.255.192.101]) by fldsmtpi01.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Dec 2017 01:58:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130302; x=1544666302; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Hnw7FF586JVESdHiTXDCj8NCrqzvap2aOHnQ+bhr50E=; b=SJRT3IpiKvbFB+4pc8V7U412tfiC3le/PGjgkYOztVCUWz9sfv97oITx nHWkQfEyEsuBi2lc+1RGHx3e3v12Nc6KzVN/cgGzNmJ44nDoU1msjrPbe CsI4eX9QAqKKwMypoz/Mlrj3kgkr4IMVMMG7nW/YYZvrpFAVe+yPnvCbN 0=; Received: from surveyor.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.83]) by atlantis.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Dec 2017 20:58:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130302; x=1544666302; h=to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:from:cc; bh=Hnw7FF586JVESdHiTXDCj8NCrqzvap2aOHnQ+bhr50E=; b=aIAc4fza0yOMosY16CprJyZZAnb1y2eBpkSg8GEGkK4WVMlllN76Fl57 IM71c7z3XyvFRW9/eSjqqgzTEsrhaHpaPOmAtb0aLJlb8g+gFXbCRkGjh NSASNoPlnBsKDqeBdCW/21WO5qGVm+foBqxOhzZ6sboZ+va0pkd6Pv3j8 U=; From: alexander.levin@verizon.com Cc: Arnd Bergmann , Ladi Prosek , "Michael S . Tsirkin" , alexander.levin@verizon.com X-Host: surveyor.tdc.vzwcorp.com Received: from ohtwi1exh001.uswin.ad.vzwcorp.com ([10.144.218.43]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 13 Dec 2017 01:58:21 +0000 Received: from tbwexch28apd.uswin.ad.vzwcorp.com (153.114.162.52) by OHTWI1EXH001.uswin.ad.vzwcorp.com (10.144.218.43) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 12 Dec 2017 20:58:21 -0500 Received: from OMZP1LUMXCA12.uswin.ad.vzwcorp.com (144.8.22.187) by tbwexch28apd.uswin.ad.vzwcorp.com (153.114.162.52) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 20:58:21 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA12.uswin.ad.vzwcorp.com (144.8.22.187) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 19:58:20 -0600 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Tue, 12 Dec 2017 19:58:20 -0600 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 060/100] virtio_balloon: prevent uninitialized variable use Thread-Topic: [PATCH AUTOSEL for 4.9 060/100] virtio_balloon: prevent uninitialized variable use Thread-Index: AQHTc7XAdtkCJqWYnkaufUWJvflwxA== Date: Wed, 13 Dec 2017 01:57:37 +0000 Message-ID: <20171213015722.6722-35-alexander.levin@verizon.com> References: <20171213015722.6722-1-alexander.levin@verizon.com> In-Reply-To: <20171213015722.6722-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit f0bb2d50dfcc519f06f901aac88502be6ff1df2c ] The latest gcc-7.0.1 snapshot reports a new warning: virtio/virtio_balloon.c: In function 'update_balloon_stats': virtio/virtio_balloon.c:258:26: error: 'events[2]' is used uninitialized in this function [-Werror=uninitialized] virtio/virtio_balloon.c:260:26: error: 'events[3]' is used uninitialized in this function [-Werror=uninitialized] virtio/virtio_balloon.c:261:56: error: 'events[18]' is used uninitialized in this function [-Werror=uninitialized] virtio/virtio_balloon.c:262:56: error: 'events[17]' is used uninitialized in this function [-Werror=uninitialized] This seems absolutely right, so we should add an extra check to prevent copying uninitialized stack data into the statistics. >From all I can tell, this has been broken since the statistics code was originally added in 2.6.34. Fixes: 9564e138b1f6 ("virtio: Add memory statistics reporting to the balloon driver (V4)") Signed-off-by: Arnd Bergmann Signed-off-by: Ladi Prosek Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- drivers/virtio/virtio_balloon.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.11.0 diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 07b07b12ef90..a7c08cc4c1b7 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -253,12 +253,14 @@ static unsigned int update_balloon_stats(struct virtio_balloon *vb) available = si_mem_available(); +#ifdef CONFIG_VM_EVENT_COUNTERS update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_IN, pages_to_bytes(events[PSWPIN])); update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_OUT, pages_to_bytes(events[PSWPOUT])); update_stat(vb, idx++, VIRTIO_BALLOON_S_MAJFLT, events[PGMAJFAULT]); update_stat(vb, idx++, VIRTIO_BALLOON_S_MINFLT, events[PGFAULT]); +#endif update_stat(vb, idx++, VIRTIO_BALLOON_S_MEMFREE, pages_to_bytes(i.freeram)); update_stat(vb, idx++, VIRTIO_BALLOON_S_MEMTOT, From patchwork Wed Dec 13 01:57:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 121713 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4911423qgn; Tue, 12 Dec 2017 18:33:22 -0800 (PST) X-Google-Smtp-Source: ACJfBot+PmU2SXgzHe/6ddHLt8E5wKX3aNsWljMBFWn261r8o2mCXjmZO+4G8qlqDrdT2ce8Swdy X-Received: by 10.98.160.70 with SMTP id r67mr4373794pfe.153.1513132402816; Tue, 12 Dec 2017 18:33:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513132402; cv=none; d=google.com; s=arc-20160816; b=a5GUa5ydaV811QZ6ZC9TAd+kYrISF3f0HIYOGhh7JdoaMFq0tr14Kcvo50SPUqV+4Y E0UJk92eIaQcR3ETThFPiQfrEMp06PNpryoce+BtuJl0haKSV4Mn5d3jGB4Qe68TFifs Te2EX8etBTsjszYZVfsEK76lsmYq2RrVag6IvGE7HzNtgzgtXPSMuaPDzJjtP5ELyo3X HzU5fU6YTEj9DNi102+75jCBlXW8ec7lpCvELU++/PMielIz4mtKJ/Lnod6qwwGEBoXi QApaBcLNwtXNpx6SAL08fEvVVqum0Khtc4Ncn+EqcOo2aaA/w7ZYEMRljmtBRMQf+BvF 68LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:cc:from:dkim-signature :dkim-signature:dkim-signature:arc-authentication-results; bh=EDpS5wB0ouPCwWThvm1D47XOJ/Pq0KGHSIY6dCfIbmI=; b=ITEWorbWokyzYjbOFyoDnMjgqCvB8N+MFiPECj5ed7HtymHv6zzqdSk2yv9PPIHm91 9T2KlkSMhXo3xUCSDjf1UJzd/DM9Yn/ctf2cNlEtZTg/ZW4uD4V8e6nI/YNoMCWvxKQc FSazVzixGdZhmUr+XUusuryshkAUsiIbLnJ8Ix4U6YeanSskH52BNKh+c7Pk83ANa/CC jmYTDUc58xharQkWq4AUq7UQnI03MVAu1xTdJISjvsQuUeQUoWcuANArZ3fvS06uiIbv utPDRXb9uUzVVohOjqTXcYKQ1m4VH/28X6sROzGvRPL4/73l3UvLSacrHuRdH55XX9RM Xjag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=SjBZSY2F; dkim=fail header.i=@verizon.com header.s=corp header.b=G6i5arVn; dkim=fail header.i=@verizon.com header.s=corp header.b=afuHVEjL; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bb8si461847plb.287.2017.12.12.18.33.22; Tue, 12 Dec 2017 18:33:22 -0800 (PST) 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=fail header.i=@verizon.com header.s=corp header.b=SjBZSY2F; dkim=fail header.i=@verizon.com header.s=corp header.b=G6i5arVn; dkim=fail header.i=@verizon.com header.s=corp header.b=afuHVEjL; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753280AbdLMCdT (ORCPT + 10 others); Tue, 12 Dec 2017 21:33:19 -0500 Received: from fldsmtpe03.verizon.com ([140.108.26.142]:44470 "EHLO fldsmtpe03.verizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753358AbdLMB7T (ORCPT ); Tue, 12 Dec 2017 20:59:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130359; x=1544666359; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=5nxAyR9Po6UATQahDzVPfJtJsGDReLxBLS4eoUTq6OM=; b=SjBZSY2FcqdTZu2FZ/o+LTGbIpwI5s7MKu24/vQW1L7e6aNwoPyDA6oF vpI3l19dP28o+hXkFvKPSXyLtkZSpgxvS4hzxo35pz/OcmPbwOsOdnoo9 ob1kOZkC9HWFBWDz4kxaO0H3CKIEG9LvA4fMUIlCY70XTeCcEubTawVBU Q=; Received: from unknown (HELO fldsmtpi01.verizon.com) ([166.68.71.143]) by fldsmtpe03.verizon.com with ESMTP; 13 Dec 2017 01:58:57 +0000 Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO apollo.verizonwireless.com) ([10.255.192.101]) by fldsmtpi01.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Dec 2017 01:58:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130312; x=1544666312; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=5nxAyR9Po6UATQahDzVPfJtJsGDReLxBLS4eoUTq6OM=; b=G6i5arVneTbFCQETIyfxzNn997kHrvTu3jXsXFLTnSnJGN47qrJ6a4eQ xZPqkJjOqofHlqobKb2DVLX2oNHsEXP7QfmqXcTeNCC25iAtuEkxBUhYx wWBGHRS4Be8175bwuHeeOoY/3E+UXft6GhKlY1AmmyUtXcYqbv7fyPPPf U=; Received: from mariner.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.84]) by apollo.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Dec 2017 20:58:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130312; x=1544666312; h=to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:from:cc; bh=5nxAyR9Po6UATQahDzVPfJtJsGDReLxBLS4eoUTq6OM=; b=afuHVEjLDV/IF+8ta0a2WqgtpbALLLM6GPUCWkPwVluNv9/RLT64cY90 MKxzf0mnxJTBV/I3JoUKygSr+RkmbKPziwmWFMDPkQHyyoygcgclMWQGp wkRrYXPjukJ16kILX1RzsJagYYgLpF0ozHzZzrAOTvUcLertWu4q58kxv Y=; From: alexander.levin@verizon.com Cc: Dan Murphy , "David S . Miller" , alexander.levin@verizon.com X-Host: mariner.tdc.vzwcorp.com Received: from ohtwi1exh003.uswin.ad.vzwcorp.com ([10.144.218.45]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 13 Dec 2017 01:58:32 +0000 Received: from tbwexch08apd.uswin.ad.vzwcorp.com (153.114.162.32) by OHTWI1EXH003.uswin.ad.vzwcorp.com (10.144.218.45) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 12 Dec 2017 20:58:32 -0500 Received: from OMZP1LUMXCA20.uswin.ad.vzwcorp.com (144.8.22.198) by tbwexch08apd.uswin.ad.vzwcorp.com (153.114.162.32) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 20:58:31 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA20.uswin.ad.vzwcorp.com (144.8.22.198) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 19:58:30 -0600 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Tue, 12 Dec 2017 19:58:30 -0600 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 076/100] net: phy: at803x: Change error to EINVAL for invalid MAC Thread-Topic: [PATCH AUTOSEL for 4.9 076/100] net: phy: at803x: Change error to EINVAL for invalid MAC Thread-Index: AQHTc7XCQ1XysuZmEEWFjg9KR3O0Tw== Date: Wed, 13 Dec 2017 01:57:41 +0000 Message-ID: <20171213015722.6722-51-alexander.levin@verizon.com> References: <20171213015722.6722-1-alexander.levin@verizon.com> In-Reply-To: <20171213015722.6722-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Murphy [ Upstream commit fc7556877d1748ac00958822a0a3bba1d4bd9e0d ] Change the return error code to EINVAL if the MAC address is not valid in the set_wol function. Signed-off-by: Dan Murphy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/at803x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index a52b560e428b..3603eec7217f 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -166,7 +166,7 @@ static int at803x_set_wol(struct phy_device *phydev, mac = (const u8 *) ndev->dev_addr; if (!is_valid_ether_addr(mac)) - return -EFAULT; + return -EINVAL; for (i = 0; i < 3; i++) { phy_write(phydev, AT803X_MMD_ACCESS_CONTROL,