From patchwork Mon Mar 19 15:58:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132090 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp84795ljb; Mon, 19 Mar 2018 14:45:16 -0700 (PDT) X-Google-Smtp-Source: AG47ELteqEq2zcBpW96kf4jOzp7GPLKTiFMPZoqQ2Kc+Yg9HJFACZ0cwjpc+DNU9lPiiiik2d7gT X-Received: by 10.99.156.17 with SMTP id f17mr10229482pge.102.1521495916658; Mon, 19 Mar 2018 14:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521495916; cv=none; d=google.com; s=arc-20160816; b=JS8wy4C1EdnE2D7X5036y5eSxIAzzhdMQHhBSkoh1owj+YmaRPMcIb7dyGooOoyi/b S2T5GueSBOqXEV1fIDND1b/cvB4NzgQYHiqnt4iQewkxoQapBqJMdc3HBwxn2/KjOG7D HGTGEXH8S1JfMeMKelOXF60EFp7CZQx5c+6Yvpl5f+H60dszTNag0eAxrsP++jXS+7ko f3+UYR3bcc88xMLLl4kM/GDjjthJnlLhdiCDm3p7PfxV9KZqq7RkKjxvHvdDVh/D30zR 0YYo6+wQPUXondz9RqYP6U8neoWX/r6LiHGgbtc/W0J3UsmrIlxmTzXpQybA6FsrdZFm UQMw== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=IozAM34NMRMJz7XimoA4bk+BAHrlf9absvZ4G+vn7Ck=; b=Ip+6or8hjfeGo9F2EahTQc4hlpLOpubjzVLgNSDeeCE+jf/E1HbCl7dc/PTyDSq10o uvrJdlsvn9ZNrxFono6KKSyrd8aQ++J69h9N97Rt/VxstOlcYW1JEA0YIWqFsJ1KxGM8 kTQwIf69WYCa+geiIxeX4j0g33t+LbLoZtFwVERqbY1G74zsAG4m/97zMHp+6tfFXEar y/W0l0XQYjKe28Q2GltZLBr1eUqcuei2OSHgRmSjxBSIt0qqpUBDS0VngDpYMSePSLGz Idi/tGqNCF82YVMi1uXb2CL9IQ40Hx+UCgmm+FqI+cB1nHcS2AXJING0GpHv9/wOPFkS jX2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=DXe3mRnC; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8-v6si168254plz.320.2018.03.19.14.45.16; Mon, 19 Mar 2018 14:45:16 -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=@microsoft.com header.s=selector1 header.b=DXe3mRnC; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S971980AbeCSVpN (ORCPT + 28 others); Mon, 19 Mar 2018 17:45:13 -0400 Received: from mail-co1nam03on0139.outbound.protection.outlook.com ([104.47.40.139]:4928 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964938AbeCSP60 (ORCPT ); Mon, 19 Mar 2018 11:58:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=IozAM34NMRMJz7XimoA4bk+BAHrlf9absvZ4G+vn7Ck=; b=DXe3mRnCbzMIEXeSTh4jgoz+ECpcsIgXiAq/7T5sf1GKXZkPmOqGRjkS+l/uC1P5WviWdB5neiebNCDCYwgIN8ahG1C3r+PtG5rTsX21V4qOnDrP/S+G5c4WFk8uzTIuV+4czscVXYXCvS/Pj0Gc+CyrxmuTwlWKAMOg2orkRLc= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0933.namprd21.prod.outlook.com (52.132.131.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.2; Mon, 19 Mar 2018 15:58:24 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:58:24 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Will Deacon , Alexander Shishkin , Arnaldo Carvalho de Melo , Jiri Olsa , Linus Torvalds , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 028/281] perf/callchain: Force USER_DS when invoking perf_callchain_user() Thread-Topic: [PATCH AUTOSEL for 4.9 028/281] perf/callchain: Force USER_DS when invoking perf_callchain_user() Thread-Index: AQHTv5scx2iaUVFoZE+HqB8iz8jBVg== Date: Mon, 19 Mar 2018 15:58:23 +0000 Message-ID: <20180319155742.13731-28-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0933; 7:ATa29ZJGos5aweRTLQmYXkmV9G7xHRsYuxxtF9XfQtmLy1m+tBu3TsO5202vJNryXt/idrpZn0iE23Rl1Ap5clR/rkAcLfcDMLInLEfRFUyaRuP7UiEov8h712QP9giboPczYLhD3zIFvlhA8WYyYUtPiPz7tzWCn8od/HoZER8K60QcaIFQZi1hLwi4u5GovdmRBnIEO2L7AurQu/DXVNDJf4Ns8H6RdYoM2aot6a/g9NK8zm2paYvG3uBsBB+8; 20:oIVKIHFuRz8O15jWOQ3GRbTGg/p90JNuIaiVcgzByS3k0MLhggMyHLwItsI9JBzl94JrP8cRDxc27werOSoo/IiDZ8XGJfiRbOcv/dZ+vlOLbAM6pe250QH1uY8Scvy2IqxJiuzHrw6X9xSXbrUA+04LDe6lSWdCPz2hWK4FEZU= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 9af78896-12f2-4b51-b306-08d58db23ee0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0933; x-ms-traffictypediagnostic: DM5PR2101MB0933: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231221)(944501300)(52105095)(6055026)(61426038)(61427038)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:DM5PR2101MB0933; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0933; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(39380400002)(366004)(346002)(376002)(199004)(189003)(2501003)(72206003)(1076002)(66066001)(10290500003)(99286004)(10090500001)(7736002)(14454004)(6116002)(5660300001)(2906002)(97736004)(6346003)(102836004)(575784001)(22452003)(86612001)(3660700001)(186003)(2900100001)(25786009)(478600001)(5250100002)(26005)(6486002)(6436002)(81156014)(81166006)(36756003)(4326008)(86362001)(76176011)(6512007)(8936002)(106356001)(3846002)(53936002)(105586002)(3280700002)(305945005)(68736007)(110136005)(2950100002)(54906003)(8676002)(107886003)(316002)(6506007)(59450400001)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0933; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: tgcRJGXz0fTQULr6qomu73P7jaCxslstCOhqM8LWHYGI3lR8LWAlVFGIFySV9/a+psOi7vCgOoRf7HzCAOJMSmZy48Hb1VA7hJSQHcJNT3BGPNPspoAgOOwkN1Dx9xGonxXa35KTH4JJAP4JF2ClsYqkhEOPev4q5+p0OGyZuTXo6jbqiqu38lM1yzsQ2sgNuM0vc/0QaEW4vf//KC0Pbp14WmwZnM8C4P/N0UbkX7RnI4/AYGsN11tifdqImrjHsJxuMwqsVyS9Nd8DgHPfYmjMYzdTDbRoQSdwwb600wa9NIiSnUfpJy6Wg2U44lmxNiDHe88vKTL4hb1yy3AwuA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9af78896-12f2-4b51-b306-08d58db23ee0 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:58:23.9590 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0933 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Will Deacon [ Upstream commit 88b0193d9418c00340e45e0a913a0813bc6c8c96 ] Perf can generate and record a user callchain in response to a synchronous request, such as a tracepoint firing. If this happens under set_fs(KERNEL_DS), then we can end up walking the user stack (and dereferencing/saving whatever we find there) without the protections usually afforded by checks such as access_ok. Rather than play whack-a-mole with each architecture's stack unwinding implementation, fix the root of the problem by ensuring that we force USER_DS when invoking perf_callchain_user from the perf core. Reported-by: Al Viro Signed-off-by: Will Deacon Acked-by: Peter Zijlstra Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Thomas Gleixner Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- kernel/events/callchain.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.14.1 diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c index e9fdb5203de5..411226b26bca 100644 --- a/kernel/events/callchain.c +++ b/kernel/events/callchain.c @@ -227,12 +227,18 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user, } if (regs) { + mm_segment_t fs; + if (crosstask) goto exit_put; if (add_mark) perf_callchain_store_context(&ctx, PERF_CONTEXT_USER); + + fs = get_fs(); + set_fs(USER_DS); perf_callchain_user(&ctx, regs); + set_fs(fs); } } From patchwork Mon Mar 19 15:59:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132089 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp75152ljb; Mon, 19 Mar 2018 14:32:53 -0700 (PDT) X-Google-Smtp-Source: AG47ELuGnOTH6qQhCHwmF0RRemoSU2YI8tbv7D170+PDpMWsNh1rYbVVztBz+CIc2jSQK5vXPZTO X-Received: by 2002:a17:902:4103:: with SMTP id e3-v6mr13967798pld.172.1521495173181; Mon, 19 Mar 2018 14:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521495173; cv=none; d=google.com; s=arc-20160816; b=YRoMsTaWqJxdqvt2GtmImHxwJzzLvztqQSIDRVNUdkxoQz6SluMbJqXnQtqWwAeNTv x/1TJ2vGdILbS0ODEiec9ifoZILnwU33I6dq3EvofBMfNBJeXRWcUE+ZWQzJocTKhM80 6g0GN4UgK9mhhh+ymwYhXK9ZWhI+unidDlDCyy+Mvz1C+ytOG+qXGJ1rInAY8S9JzUaX oTPOKjFj4Yl9hIy96Z0odFHuS8VuMYRaTEWYer8/kp1DmVOafqAyzUHl5yCPndkeJPJC AIYQKNDuYnssbkMjyp0Gb+NyqKHf82QJjfP+NyU7CPzw3CSfEPDPloB5fIAMjfRQh/Os fWMQ== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=R6Ep0p0kmfv9aZ+UO19+Tojti3NkRi5DKoH3sh5YEOs=; b=oJznvXIG8waivYjoVECd6iLuoeki63rA+T81mbk2na/soRoVp4Fcyf/8CBtyxdaIfi vDvHzrdSNYbmLYdi8MjCFNzVVWaIZE/TTwVIQqBTu0L3QecXr5Sups0COKdwsDLTg6GN vYwhY0fNfj31/YLEZekqGW/Bdnvkby1kwIh4J2bHxpdjvAfhiz+gXfX5T7SIwrs8/NM0 PGLwv7f5hGGBgwQnGpisptQTa7ZP43XRdCc7JWzzzNAVeCUEJBdoO8i2h0cyqLKVg0oM eNTRhuSl8FpuhGnmZ4tuUaQwzPd5qWV1dBXVg5C3fc7uv/LDugmPiuDV3bIfDp0NcisR PvyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=SGrPwA3p; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l14si114744pgn.188.2018.03.19.14.32.52; Mon, 19 Mar 2018 14:32:53 -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=@microsoft.com header.s=selector1 header.b=SGrPwA3p; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970962AbeCSVcu (ORCPT + 28 others); Mon, 19 Mar 2018 17:32:50 -0400 Received: from mail-by2nam01on0128.outbound.protection.outlook.com ([104.47.34.128]:43648 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965185AbeCSP75 (ORCPT ); Mon, 19 Mar 2018 11:59:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=R6Ep0p0kmfv9aZ+UO19+Tojti3NkRi5DKoH3sh5YEOs=; b=SGrPwA3pC/37EAWWGzHeXSPS5T3mRsaTu7Ux/jd4tpN25awUebgLwHvKlOgC+/SvZDAAkq9UYDtdlR2bGXH599fi3dwwTq4Pu3NnjUWQ1xXTNV3Nd3MmUbjdrvaStSzMJQqbZBs5VrFNJ0nfPZfbWWf9Xl80rxlnu22zxQkCHAI= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0965.namprd21.prod.outlook.com (52.132.133.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:59:54 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:59:54 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Suman Anna , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 062/281] uio: fix incorrect memory leak cleanup Thread-Topic: [PATCH AUTOSEL for 4.9 062/281] uio: fix incorrect memory leak cleanup Thread-Index: AQHTv5sz9quVrKCnTkSJB/hrvviQAA== Date: Mon, 19 Mar 2018 15:59:02 +0000 Message-ID: <20180319155742.13731-62-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0965; 7:US3Zs0j02vQ59ji3Wj4wR+goe8XCIYLP/k/CAojThIjGV127xbavOAxOvuVzUERyE0yBO1b9qHrtajoT1pvGUbhs0HjBSMzH+++xdovzT5FdXKyw+SYHW1s7whvPfYnijhv8Eo8KU3MyGy4se19H4QtUjNpu6a50kaa6FAcOKYmQukFYg2+6sdh2FmWdwpTR/JGe65vDg1dUzHJvid6rrPeXKZV5TaegzYIJ8QATSoOvzBZd0rGnHfs5NlX5OpG6; 20:0cM0MKeO8Gz4FuVdKLXYxxBK+QZKiX523pwMmfOdLnM1aim8KWXcfLx5wkBJChDDPE9iZHJLFHHlh2NeMkRqRIM2pk33l94NKHUTcy2g7Lm7snIrEQoH5Mqepdf1uN8hcsT5j8eflLEo42rthjXejEgkDFHMgSIOG0LbNggzJhs= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: a7f5f0e1-dd88-4fc7-df25-08d58db274f5 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0965; x-ms-traffictypediagnostic: DM5PR2101MB0965: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(31051911155226)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB0965; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0965; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(366004)(396003)(39860400002)(376002)(39380400002)(189003)(199004)(25786009)(7736002)(6506007)(86362001)(575784001)(86612001)(10090500001)(478600001)(53936002)(6666003)(6512007)(36756003)(2950100002)(8936002)(110136005)(54906003)(105586002)(14454004)(107886003)(72206003)(10290500003)(316002)(102836004)(2501003)(59450400001)(5250100002)(99286004)(22452003)(305945005)(6436002)(6486002)(1076002)(76176011)(26005)(4326008)(186003)(97736004)(106356001)(3660700001)(3846002)(6116002)(5660300001)(68736007)(2900100001)(8676002)(81166006)(81156014)(3280700002)(2906002)(66066001)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0965; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Y3TJAvsUnRZ/kJ6oDUSxVMY2DGFxLCcwBy4GeKaZZnKm1YrQKiv7YnqO4j0h4mhLRvRn295LIFdekTu8dQtVIGugJ22TcA62PaC7SdJTuTQvIc1RocQKeziEk+XCnE+pJ5i6qckIdvHmCOm1naZCKmJYcrhe3m673iPWmyCEUn0MBbY6zVSrOylPiTEkrk6VSoCp9MDRcd9LhCVAxECmXEYr3WEU3G1zYbQNjRIyaKzb4Ili0VaD2GbCLKaQVj9+ewkRphtHruH3FYzYp403bd6vdIOl907ervNS2SbwON+YCzjRT7XgjlURq7NJyw2eKSQ4OXCv5GR0YCj9WcXdxg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7f5f0e1-dd88-4fc7-df25-08d58db274f5 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:59:02.6410 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0965 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suman Anna [ Upstream commit 0d83539092ddb1ab79b4d65bccb866bf07ea2ccd ] Commit 75f0aef6220d ("uio: fix memory leak") has fixed up some memory leaks during the failure paths of the addition of uio attributes, but still is not correct entirely. A kobject_uevent() failure still needs a kobject_put() and the kobject container structure allocation failure before the kobject_init() doesn't need a kobject_put(). Fix this properly. Fixes: 75f0aef6220d ("uio: fix memory leak") Signed-off-by: Suman Anna Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/uio/uio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.14.1 diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index fba021f5736a..208bc52fc84d 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -279,7 +279,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) map = kzalloc(sizeof(*map), GFP_KERNEL); if (!map) { ret = -ENOMEM; - goto err_map_kobj; + goto err_map; } kobject_init(&map->kobj, &map_attr_type); map->mem = mem; @@ -289,7 +289,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) goto err_map_kobj; ret = kobject_uevent(&map->kobj, KOBJ_ADD); if (ret) - goto err_map; + goto err_map_kobj; } for (pi = 0; pi < MAX_UIO_PORT_REGIONS; pi++) { @@ -308,7 +308,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) portio = kzalloc(sizeof(*portio), GFP_KERNEL); if (!portio) { ret = -ENOMEM; - goto err_portio_kobj; + goto err_portio; } kobject_init(&portio->kobj, &portio_attr_type); portio->port = port; @@ -319,7 +319,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) goto err_portio_kobj; ret = kobject_uevent(&portio->kobj, KOBJ_ADD); if (ret) - goto err_portio; + goto err_portio_kobj; } return 0; From patchwork Mon Mar 19 15:59:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132088 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp67735ljb; Mon, 19 Mar 2018 14:24:04 -0700 (PDT) X-Google-Smtp-Source: AG47ELuLtQh+nfzcuNAfAhd4mw8rRTDHcwKTeQ9DASay4clWo3MdMcyoiU1UZzkflTKv997pH8Mu X-Received: by 2002:a17:902:bd46:: with SMTP id b6-v6mr13699466plx.38.1521494644739; Mon, 19 Mar 2018 14:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521494644; cv=none; d=google.com; s=arc-20160816; b=ObARK7Pg8mTvzqrNtrLYDzKrZLhnk2TegXIjJ0w6tzBFxHS1St0eD14k73z1pmNJNy XRgSFJh7pQ6xckzRmRJZz6EPOYlTiqO+bxFL34vO/osQgU5UTG3KPzjPQHXY0LPv3ugK m1H2i/GUXPtcg75fAl7TCv7qF6J6uRo1ZaVsTPaBhANdz5MnPArcvNYkA8ZIhuLFBMrY ia4hTjHce7wtbJgNZE1ghSVJZTtCmzFNISnjBicqbRRA6zuFUNo4llmv/arvPmWxvEDK B+SI02nfUhd/9h42ffwDFpjXso8RVsNBOwORFNmlYumjvCgVe2Vu5m4n2KejydxdqNsU j60Q== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=N5d25f0oKnulkQWva1uP8wQDxssyF+OXLu4kzs9yxRY=; b=BTVDIWch6Eeh3HtYZnspp5YPvS6JMNIoXejT3bOfb3TqnsE//K9gulM7Cmof4Tc02a s5jnFyg7LSwESi1OuwPBJwKNgu8Ev9a680qkBax0KP32vtdMNXTEH3KAdYL/bxzGmEow 4PdhF73lhqJoKdp99/v1pPpLpL/VhonFUwJlCz3yzTi/kLzi3us/C/sKqnxJVVDq00b2 fSQNDxSpcZJfPFvQNxVuPaH34wBtxEL1Gs+yWvYbeIUKFGk/EJCDiyVFysUDzyX4NfHl clm+Z0YuGd7sKt5uLajlrJff+WTIQo9b+Zoj7EMgNdz0yD217iBXk87045JHy/O3w91o l9fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=oC/nqZQU; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k17si94315pgf.534.2018.03.19.14.24.04; Mon, 19 Mar 2018 14:24:04 -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=@microsoft.com header.s=selector1 header.b=oC/nqZQU; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031138AbeCSVYB (ORCPT + 28 others); Mon, 19 Mar 2018 17:24:01 -0400 Received: from mail-sn1nam02on0102.outbound.protection.outlook.com ([104.47.36.102]:56553 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934840AbeCSQAX (ORCPT ); Mon, 19 Mar 2018 12:00:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=N5d25f0oKnulkQWva1uP8wQDxssyF+OXLu4kzs9yxRY=; b=oC/nqZQUXBbdRBvnK30UepFiwmMOMKZnv1xk2unqQnxEK70e2cx95k+axn3rHKxinYiGyQK6mIrNkzt2o+FOC63+P2JnQhggcNOsIKbW51WmPKjaOGaKmG2SrAjsgjtrCJ4QUGaVRTn7S68R36uFS0g2rF46LDyVyCxfDFCJxqg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0984.namprd21.prod.outlook.com (52.132.133.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:00:08 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:00:08 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Suman Anna , Sekhar Nori , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 089/281] ARM: davinci: da8xx: Create DSP device only when assigned memory Thread-Topic: [PATCH AUTOSEL for 4.9 089/281] ARM: davinci: da8xx: Create DSP device only when assigned memory Thread-Index: AQHTv5tHdCckqqxJB0yNatoZ5wTJeQ== Date: Mon, 19 Mar 2018 15:59:37 +0000 Message-ID: <20180319155742.13731-89-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0984; 7:yd6D6UlYHMVDndWkCnYWL2r1QBYTLIppo9Vsl5NH0r9vAtfdugOqw19CmSjAOJBABnE6QUMUyb73UQF/4e5rz5vGQwWNT9F2PuILcX8l6snrdyabGTv7SuAAfnOif9YOmzgXnArDgU+GyvWjGnhMNtVgzOiWhIOFll9hICeYIYUgrUDtQn3fSyglFjd1p4ZqvKMrog7RhOycNvNzyAfnUACzHWCM0DvfYON+VqdL1E+XcX5B4PVEnGQxY2rc/yZE; 20:STrakXJMFvCPIrhY2ADobqXWFgqqPoEvNDaup6IVDtmFxXP/p9GSsh9y9enFEnibBR5A17llFFSeLLbEehgvqj9s/A+Dv/jo6LE72q/4T8l4RMjnAQ1nIFCoCS0pQYcvYnxDrAOciSbxxYDa03E33znZTkHx8M0VffAf6OxbrYc= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 7a08e85d-e6fb-4671-c59b-08d58db27d20 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0984; x-ms-traffictypediagnostic: DM5PR2101MB0984: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(31051911155226)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB0984; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0984; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(376002)(366004)(39860400002)(39380400002)(396003)(189003)(199004)(6116002)(25786009)(6486002)(97736004)(1076002)(4326008)(2950100002)(6666003)(66066001)(3846002)(36756003)(81166006)(8676002)(6436002)(106356001)(8936002)(81156014)(2900100001)(105586002)(5250100002)(2501003)(305945005)(7736002)(10090500001)(5660300001)(14454004)(54906003)(68736007)(99286004)(26005)(186003)(6506007)(3280700002)(478600001)(3660700001)(86362001)(107886003)(10290500003)(6512007)(86612001)(72206003)(53936002)(76176011)(316002)(22452003)(102836004)(110136005)(2906002)(22906009)(32563001)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0984; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: mORejoKZJq06BQ0qNPSAgB28mrYA3uqvC9a+dFkslpdGY/B1TKcyzPKCPScGc+q1AOh2TFbg5hzMysGNtutL4ln5FlImhWWKTWlaAuu2DTJJWs7UKPpoR4B8K7m3H33HxtLAriGRI0s3GNV0RWDkSfUARNrt+RdqbRDR9ZXYFsipMNe1A70CVRBMC7pvNeRM0TiJI6K++6WsmhjviyFOcbO/NV1Yu/ajMtYmPexu85rzv3ukxQ3VSjL1Zsfjp2y4qdziWVDbjQ7kWcFRmw3+vpmMWfX0IubHsX7q0IqJ0iYTRQmeqfJSfOBjKlixo4Lk8B+mHfTVUc8Q4DUicGNSdw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a08e85d-e6fb-4671-c59b-08d58db27d20 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:59:37.1130 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0984 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suman Anna [ Upstream commit f97f03578b997a8ec2b9bc4928f958a865137268 ] The DSP device on Davinci platforms does not have an MMU and requires specific DDR memory to boot. This memory is reserved using the rproc_mem kernel boot parameter and is assigned to the device on non-DT boots. The remoteproc core uses the DMA API and so will fall back to assigning random memory if this memory is not assigned to the device, but the DSP remote processor boot will not be successful in such cases. So, check that memory has been reserved and assigned to the device specifically before even creating the DSP device. Signed-off-by: Suman Anna Signed-off-by: Sekhar Nori Signed-off-by: Sasha Levin --- arch/arm/mach-davinci/devices-da8xx.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.14.1 diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index add3771d38f6..9a22d40602aa 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c @@ -821,6 +821,8 @@ static struct platform_device da8xx_dsp = { .resource = da8xx_rproc_resources, }; +static bool rproc_mem_inited __initdata; + #if IS_ENABLED(CONFIG_DA8XX_REMOTEPROC) static phys_addr_t rproc_base __initdata; @@ -859,6 +861,8 @@ void __init da8xx_rproc_reserve_cma(void) ret = dma_declare_contiguous(&da8xx_dsp.dev, rproc_size, rproc_base, 0); if (ret) pr_err("%s: dma_declare_contiguous failed %d\n", __func__, ret); + else + rproc_mem_inited = true; } #else @@ -873,6 +877,12 @@ int __init da8xx_register_rproc(void) { int ret; + if (!rproc_mem_inited) { + pr_warn("%s: memory not reserved for DSP, not registering DSP device\n", + __func__); + return -ENOMEM; + } + ret = platform_device_register(&da8xx_dsp); if (ret) pr_err("%s: can't register DSP device: %d\n", __func__, ret); From patchwork Mon Mar 19 16:00:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132087 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp51856ljb; Mon, 19 Mar 2018 14:05:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELvdhQgYzMFX7isKd+/JCHHxkp943/0Y4OGi3O0le96mHMagHpU2B53MML+P1Tgojqbphtod X-Received: by 10.98.39.7 with SMTP id n7mr9727412pfn.161.1521493540938; Mon, 19 Mar 2018 14:05:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521493540; cv=none; d=google.com; s=arc-20160816; b=e9KsF15o+kXEiqOFlUH/W7cQjfAJweQLTwoJ7nvTBm2J6Am2Lfs/H+2mq5Uj3moNUE GgIxywtwTTrT7yBpvm3yarqbYzh2AI/GOqo2CgTpmiYHN5z+DdgmPwmpleBCKoVjNfmm Jp1AvltTtdyZRMhHMpmQ3vETTMwbZjen0u4YnaMz0MfRrZmNSGH6wpypN46KYLbZsOPK 1RYu62Kcur3UzzpVMO/eKcOrD7wQW1VIsGt+DCSF1VC8SoUEgwiJyLj6xxsAiZ3/xvU3 mO/gIXXn5oJZncgGkYXgVWbndWIyfiAU26sEQ2E+naTjWep0u0RcZ6UiIvKvw57f9ilG 5zTQ== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=EJwL4tvhXzoaOOF7EmDtg8Dpg7cLWV6DbXyaeR00pUM=; b=yIQRg1/MdXx8/OcTv+q//yKuuQr1O8u1GDAk93T8rFgahdqD6usW3TPNwRWoof19tu oh25abvHVVcPrLwnrYFAmFSadxIHlTu0ehjB2qvcIh5HRkN2AEmouD6Bp5raftUnqPLE ZC5wTF4YsvyVyXlXrmizqwCLdm6xRnucY0/Xj2Ju+epxT9aWtMdukVWEHSa02Nb4HuQN gGxShJBd0PbQbwgTCBM6qKKipn+grf6eQ1XCH47NVo2KXruc8NPe4CsWGshmzJ2r0DlJ ajM4ORB3UOnwTsSw2X91rpc/BJaDlfV5pm5zbCNYWzMCg6M7ANnUdOs3SvwBX6L9AQZB WxTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=OvlP/sGK; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 30-v6si89211pla.444.2018.03.19.14.05.40; Mon, 19 Mar 2018 14:05:40 -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=@microsoft.com header.s=selector1 header.b=OvlP/sGK; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935950AbeCSVFh (ORCPT + 28 others); Mon, 19 Mar 2018 17:05:37 -0400 Received: from mail-by2nam03on0102.outbound.protection.outlook.com ([104.47.42.102]:15805 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965402AbeCSQCJ (ORCPT ); Mon, 19 Mar 2018 12:02:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EJwL4tvhXzoaOOF7EmDtg8Dpg7cLWV6DbXyaeR00pUM=; b=OvlP/sGKm8gJHSntFDTJCMliQprjvndfwoefHppcP0yJ+3WrQs+h1BEUzdFtsy/qlJNt2Ionrf2M+VUJTdp1zNL8UdaiSMCL/97czItkOT80pW0z81oO60liC8p+v0c3mczrFBeH8Nz/e+VRhwhxa+KJXG5yAnHijOEeSUNToF8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0919.namprd21.prod.outlook.com (52.132.132.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:01:54 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:01:54 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Linus Walleij , "Reported-by : Jason Kridner" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 143/281] gpio: label descriptors using the device name Thread-Topic: [PATCH AUTOSEL for 4.9 143/281] gpio: label descriptors using the device name Thread-Index: AQHTv5tundPwP6roUE2iSbsKOBYZGg== Date: Mon, 19 Mar 2018 16:00:42 +0000 Message-ID: <20180319155742.13731-143-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0919; 7:vM4rHg7lFOTu4jt4F7r19MMNjZ+4T9WdZMTGjwppMLycmS6EGxZYE5+PKPuKOu2xVMmfbX2YRPv/U7VMlBDLx7PyOW/XN9C3AFNn3A68c8kx9Ja4bpH32GLd0BoI07iWGkK2X3EuUUBvblRp8wTJ/644jlHQmSgOouLFmVYg9FpWwhUtJ6T3mNELrv/o4sgmss2aIbIAMqjmXcr3hHVi+kSU5IIFIXfxRSyD2h3LkuYAmFclLgFwIYCn4/iCZ7Rx; 20:lIvigBtoQjh2BojaxYKRn2HCGQPSU/f6fDPxDTmCxEloDBegYxaHYHzZLnvo4FYNTWPv/vv3PSlY56V16eF8NHoMy7jkAGG5Hda4MU+TwsdcPjwL64dsX+tUQ6rvutIYbsDSPQ/BJSIHSFJzhJaBDdQryCHcP9omQ3TWCoAJ6p8= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 1ea606be-07b9-482b-7769-08d58db2bc85 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0919; x-ms-traffictypediagnostic: DM5PR2101MB0919: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB0919; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0919; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(39380400002)(396003)(39860400002)(376002)(366004)(199004)(189003)(66066001)(2906002)(86362001)(10290500003)(105586002)(8676002)(305945005)(110136005)(478600001)(4326008)(7736002)(81166006)(3280700002)(6506007)(97736004)(107886003)(5660300001)(36756003)(8936002)(53936002)(86612001)(14454004)(59450400001)(1076002)(2501003)(6116002)(10090500001)(76176011)(186003)(3846002)(5250100002)(6512007)(99286004)(102836004)(106356001)(72206003)(81156014)(2950100002)(6666003)(54906003)(3660700001)(22452003)(68736007)(6486002)(25786009)(26005)(316002)(2900100001)(6436002)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0919; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: xIhL56qlfxdeu4wUBqoqFFtEcXQb3KYK5FlBakFQmLpsKTZqMjVPqacUziQPgMYRv/5QB/FwRuDSL4P4ECeL6zFQCPowO+GaqpuR2t+eAev5L6hDWkyzDdFz5Rzd12AAdwtQbjpxTk648zZPx/gkKm1EMCPV7rS8VBh7dL5jWtz8U5nW2Q5+/tGNq/6L2nSEzTxZiSqm1wDgEAnCOLzF3WYPHxDRtGzO/e4KE/WB6nyUO9D7EEhK+DHNHm7tbnUhzbBrKDuiHLLp4pRPOBAFfdaYudrLpVFeIJgvFjFFmslqgbSYIw4z7hjfHtjahbZzLdxCcOz/q11dvlIDHrn+cA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ea606be-07b9-482b-7769-08d58db2bc85 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:00:42.6492 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0919 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Walleij [ Upstream commit 24e78079bf2250874e33da2e7cfbb6db72d3caf4 ] Some GPIO lines appear named "?" in the lsgpio dump due to their requesting drivers not passing a reasonable label. Most typically this happens if a device tree node just defines gpios = <...> and not foo-gpios = <...>, the former gets named "foo" and the latter gets named "?". However the struct device passed in is always valid so let's just label the GPIO with dev_name() on the device if no proper label was passed. Cc: Reported-by: Jason Kridner Reported-by: Jason Kridner Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/gpio/gpiolib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.14.1 diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index f3c3680963b9..4f54ff45e09e 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -3231,7 +3231,8 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, return desc; } - status = gpiod_request(desc, con_id); + /* If a connection label was passed use that, else use the device name as label */ + status = gpiod_request(desc, con_id ? con_id : dev_name(dev)); if (status < 0) return ERR_PTR(status); From patchwork Mon Mar 19 16:01:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132044 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2897811ljb; Mon, 19 Mar 2018 09:03:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELuQjzVuw2/3NVTm618qosC4lnMgjKIm2hq/jzufPoafWHafxMRfJly6bput24ixb0Y3AQBb X-Received: by 10.99.152.10 with SMTP id q10mr9565970pgd.62.1521475420789; Mon, 19 Mar 2018 09:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521475420; cv=none; d=google.com; s=arc-20160816; b=Gpa7GsklAc8LZCh7BGXqbXKLSYNTnZPjBudJMa1Q83v3rj59iy2N4gwUoIePRhrZxk H8iyxqRKza/sPl4NAVEc9isV/a2ZeWcLaZvW2wSug6v0waqQgxBAZ302Qnu+xtws2VxM RCOpJmlyO+YhCyXjGove9gW2rTed7n9FFqjwq4U/WDRZFMgUSmsUxs6mbJ1Sk2HPpTcG eWoRxXQB1k5r7fa9OqlCPPEBt6dQHJnbbC62pLalk2iykgAU0MfgdZCcDNLTso1RzPau 79+J307lXpXyiqwwDyKbGwzatH4NxkQVNEZyQnjetWbni/k/iS7mZjcdOM9HVNUEc+d6 PfYw== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=QoYdUxoV2ywwpXdDMj6MqnIEaWTSAabMPpYy5LdAmX4=; b=FRxd+qV0PPEtvbjMCtnRIHcodX96E7myTBn5VrChjPGsQH0FwH7boJ7tekdnU9TOsX FtOUClWKw6RCwe84SMKDgotgMLUmpYmcHIYEWbwFAUI83l6W3JSpOkS7B166e/OWZJnB WEGdVHoObHI0tuVALo1O071JRC5gsNkns1GXZYJvJ9lormzr+9FrGfcIMyT8uD9DXHRV dG2utaBIVTXuD4Tah74kaTwFHwHcmaBlieBpYgJaB4UJuh2p/t1ESe8H1FZvZxdzD0jV TGLk2yJb4y+lmAjsI/FDMethYXPlwUZz1Nrzc0nmaXQ8x6qIJR2U8FP5QRHNzn1wiD26 hrPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=M5dapYdt; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h7si165296pgc.663.2018.03.19.09.03.37; Mon, 19 Mar 2018 09:03:40 -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=@microsoft.com header.s=selector1 header.b=M5dapYdt; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935038AbeCSQDe (ORCPT + 28 others); Mon, 19 Mar 2018 12:03:34 -0400 Received: from mail-cys01nam02on0106.outbound.protection.outlook.com ([104.47.37.106]:53674 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965533AbeCSQDJ (ORCPT ); Mon, 19 Mar 2018 12:03:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=QoYdUxoV2ywwpXdDMj6MqnIEaWTSAabMPpYy5LdAmX4=; b=M5dapYdt5klvAGJ20Ea89SE2bATgvSGEmuNCcRyQ73nHecrrr+jt2ZkfsfD8dbp24gp+ZpUEj+IVzHpXolQjaLwajRBAcIfpMLBvGPosj+SN+CbmRqMzMyPqt2RKX0XtUIfz3W8PqJ4lOxV36/YBbKVLwUJMAe0pV7+xMK7IZ4k= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0725.namprd21.prod.outlook.com (10.167.107.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:02:58 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:02:58 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Maxime Ripard , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 172/281] drm/sun4i: Ignore the generic connectors for components Thread-Topic: [PATCH AUTOSEL for 4.9 172/281] drm/sun4i: Ignore the generic connectors for components Thread-Index: AQHTv5uD9qgG6lP+3keco7sYJnubnA== Date: Mon, 19 Mar 2018 16:01:17 +0000 Message-ID: <20180319155742.13731-172-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0725; 7:ok7zNkJzWk7luYdncS2f4etChJ7sdK+N5ycQk8w2aG/hogZNX+Uof5rLV1jhZdSfNYjPZKepDwls0ekjtfhucBS0r+F1FmkrA2LdEt73QD1U7vAfuz8rU8iIqCIdMBdggXjirWo60zU0U5pIaGLAj1cBx33OjW4YzXmzKTOvXRgfQK9T7WtExlrnRTIYAMMDyO6zHjAW7xzEEtMZWrVkbSa1R7eDci1iQfqWoop1uTo7NRPrGlcXUPywsvsOk12w; 20:nRB4tGxKsOPKQ3nBkgOGyfmULdrxEwRJLDh7UXLcagLqa0JMKXoASMNOaO8bbqBJGzV1hEh2d6Ra/89dSJl+DFkzK9cqmdAWEl0Vuc4Ab/LwTxAYZfc3EC0LrW9DZVFG3Jbyi0DcLMpUNeIV2qKysVisfNGVvYCS9WmLzarXP/8= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ec03643b-b226-414e-a78a-08d58db2e273 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0725; x-ms-traffictypediagnostic: DM5PR2101MB0725: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(58145275503218); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB0725; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0725; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(39860400002)(376002)(346002)(366004)(39380400002)(199004)(189003)(2900100001)(4326008)(54906003)(10090500001)(81166006)(316002)(2906002)(14454004)(110136005)(107886003)(6506007)(186003)(81156014)(22452003)(68736007)(53936002)(3660700001)(478600001)(5250100002)(2501003)(99286004)(36756003)(105586002)(6116002)(3846002)(5660300001)(72206003)(1076002)(2950100002)(6666003)(305945005)(6436002)(86612001)(66066001)(10290500003)(76176011)(97736004)(8676002)(7736002)(8936002)(6512007)(102836004)(106356001)(3280700002)(6486002)(86362001)(25786009)(26005)(22906009)(41533002)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0725; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: LQ+ZSkklCYe0zaORtgfjzriNX/IW3YTAJdvLx3fVQzKywMfRkRa3WTiCZRja55N/Cfcl9t1eEXSqi4Utl8JQ1h9yN2R3bCMd7CHIqQhTDJFegEW54kVPGKcj3dK8T+KnOJwIH2Hica3ajdUqKK6u9CRNdFxJOK26vSyxBwOVFDhU5ZL8DxtnSW9wptWLOw8hdwq5EBx1n9Vi4ez3Wo19iefuTCxqGjS3aNGa9imDqVlYrjcLBKm2K++Csh5QpAQ+NcLbxvnx2H0GEY/zl7oxmOrR0dNyG0gDSLrPXCLAqgDpMYtfcn7RGa+bJM5ve1zJ28g/ZOS/LNPJ2BGudTTENQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec03643b-b226-414e-a78a-08d58db2e273 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:01:17.1820 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0725 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxime Ripard [ Upstream commit 49baeb074783f5bdf770dc9fac5fbb2837190583 ] The generic connectors such as hdmi-connector doesn't have any driver in, so if they are added to the component list, we will be waiting forever for a non-existing driver to probe. Add a list of the connectors we want to ignore when building our component list. Reviewed-by: Chen-Yu Tsai Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin --- drivers/gpu/drm/sun4i/sun4i_drv.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.14.1 diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 1feec34ca9dd..7a3d8e8eed75 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -206,6 +206,11 @@ static const struct component_master_ops sun4i_drv_master_ops = { .unbind = sun4i_drv_unbind, }; +static bool sun4i_drv_node_is_connector(struct device_node *node) +{ + return of_device_is_compatible(node, "hdmi-connector"); +} + static bool sun4i_drv_node_is_frontend(struct device_node *node) { return of_device_is_compatible(node, "allwinner,sun5i-a13-display-frontend") || @@ -246,6 +251,13 @@ static int sun4i_drv_add_endpoints(struct device *dev, !of_device_is_available(node)) return 0; + /* + * The connectors will be the last nodes in our pipeline, we + * can just bail out. + */ + if (sun4i_drv_node_is_connector(node)) + return 0; + if (!sun4i_drv_node_is_frontend(node)) { /* Add current component */ DRM_DEBUG_DRIVER("Adding component %s\n", From patchwork Mon Mar 19 16:01:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132045 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2898086ljb; Mon, 19 Mar 2018 09:03:54 -0700 (PDT) X-Google-Smtp-Source: AG47ELu87a3M5JLPx7asX6c8KSEjbAAzu9DiyYd9G+MMJJ+exVFyac/z2mQDtwYXN6X2qmE+j1fe X-Received: by 2002:a17:902:7716:: with SMTP id n22-v6mr12700316pll.268.1521475434402; Mon, 19 Mar 2018 09:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521475434; cv=none; d=google.com; s=arc-20160816; b=EYTFL7GkrmajzAfUaQgTVqWI9yWJequnZhavVl468xMQQGQS7bjciyg/VQ4XDcTmr6 3PlsQeJlDwnM/WXIWsvmLpcJXz/WjaIpA8cWNQeGdgm/2PDe2eEnd1pHDGRHo4298iuq smuMTSbG4k9sHYhimjQFkw9LETikvNEO3+b0tNxriQZQ0dx64RXi7840SeDqXwc6ke5Y d2KymQt7+LerWgVppPMzYkMflpf3Jr/vjui8gO2mGCP7QB7x2N1q+3FEVISaDBkk9IcX c0shtSC3hmkLK6SKk5ZclXOjsCHI0XGQyH6UxKaDC5c/7OlsKX4w0Wyp9y2ESEj1F+HT ab0g== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=7zlE5W9gItGkMZCouwsNf2IOb03X20RVdCi3+klF3r4=; b=ssBD8ddOXk0AwijnlUD6NBfGxO0f6SzX7rQJAv2DECbcfH1mVLntt7SaJb3+JYjLvj nuxi0XjhJdDDJNm5eOidMcq5jC5H7b5oaXd0h2+ORS/LjAxezYbeYOJPs6y+12kpM+K1 imwWOMKmWw/tyOWRcCkcY8fW5eYwv/HGJoINIU1h8GhxiPmRWk9mwPQOb9tmrPoqBlPy a1xqgJgvmOTXjDMe4VpJyQMVSLhyv9tpu/H2aQ/XaL4jti/hM5dUFsb64YFNVwyCcsNA boijD8+qWEJRQ1KEVlQm+4jBCaRaXkGJLd8UTZ2xsdphHa0mlJgBVxtXMMR5tSje8JBj Q4TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=G/IPfaZ/; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6si173366pgf.310.2018.03.19.09.03.50; Mon, 19 Mar 2018 09:03:54 -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=@microsoft.com header.s=selector1 header.b=G/IPfaZ/; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965599AbeCSQDs (ORCPT + 28 others); Mon, 19 Mar 2018 12:03:48 -0400 Received: from mail-cys01nam02on0139.outbound.protection.outlook.com ([104.47.37.139]:43744 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932923AbeCSQDT (ORCPT ); Mon, 19 Mar 2018 12:03:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7zlE5W9gItGkMZCouwsNf2IOb03X20RVdCi3+klF3r4=; b=G/IPfaZ/gMHtHMjEbwvIByuodkLwoi0lVGmOpa/tn3H5PbHdsCmRFcVit3XktqSTvX95CovCS4Di3HD2FqgVdEdpHj9/Gee7fDj0zqnxaOEfBcMGCnf16pNfKuVL4TjIL240VgtXDaRW8/yh3spN1g9n6PFfV6fxLctRGXs4FZ8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0725.namprd21.prod.outlook.com (10.167.107.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:03:13 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:03:13 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Masahiro Yamada , Boris Brezillon , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 175/281] mtd: nand: check ecc->total sanity in nand_scan_tail Thread-Topic: [PATCH AUTOSEL for 4.9 175/281] mtd: nand: check ecc->total sanity in nand_scan_tail Thread-Index: AQHTv5uF4W3uZ3mFKU2+UKkRCyd0Aw== Date: Mon, 19 Mar 2018 16:01:20 +0000 Message-ID: <20180319155742.13731-175-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0725; 7:ZwPvRxkBBEIK/UiTX4fpgwnhmzSU4opjIVx9096+07JuZJPcxZHHsLlkGS63RJ9jj9nOWcjNDdW0/6tM+HtRYUwmDyLQig9d2Ai7vVRGn99GVnrhDXKeb0+Jrhl2SrsbSBOXLrSk7qtJ36oed6yKkrhQC6p6yn4zLX7j2FiL5rsFxIMqV3pMFxC7nt2plFTsiMXLAeIf28Lkwr/nFBCHF57pr0n+CRukoC72QU5FtP1IrgKN5ei20Ulyn/nkpq38; 20:lMu4b/NEXJU66VGIVh6UrvCT6z4W8G0pQJnSaYrADd5RS7mU/b381xKSQu1d7FZnUZbHTiUObu8Yu7G3BfVOlA8RlHW1ERkNNSLQyCuy0ilMqzahsAkM/FKL5Dqp5adL/iWl/VWqERWBzTAkBhI3ThUNPsxSXn79cdKCcGlKwuc= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b1f2bed9-d19d-41b2-1597-08d58db2eb62 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0725; x-ms-traffictypediagnostic: DM5PR2101MB0725: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(58145275503218); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB0725; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0725; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(39860400002)(376002)(346002)(366004)(39380400002)(199004)(189003)(2900100001)(4326008)(54906003)(10090500001)(81166006)(316002)(2906002)(14454004)(110136005)(107886003)(6506007)(186003)(81156014)(22452003)(68736007)(53936002)(3660700001)(478600001)(5250100002)(2501003)(99286004)(36756003)(105586002)(6116002)(3846002)(5660300001)(72206003)(1076002)(2950100002)(6666003)(305945005)(6436002)(86612001)(66066001)(10290500003)(76176011)(97736004)(8676002)(7736002)(8936002)(6512007)(102836004)(106356001)(3280700002)(6486002)(86362001)(25786009)(575784001)(26005)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0725; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 5VdpbfzseeUrbtbo5pqR1ZzKmXEEFZGhdNLboK6dVmB2zqPSdfTtb5rXyoPshsp7GkTb9f2ZersOOS9g7+xkydROJ4fuhpHiSWAc0Zw/U96dml9WRGxdSF3TdiWdfu/8EP3uSYotlt50cR1u08ehYO+h/N5HK9tMgomVbx5pVbaigL0b064IVjxR2RYea0Uj6WVMVNmLj20/3lSlMCY8uEbJtPe0bbPNcgbUiypmju/EP3T0gMccJCnkoxENh3UB9nSZbu+wSduOk58phsnj+kA2xB96YQirpo0ITf2C8248vdcTXLn6XEJ59m2brWy6cf1xfFn64kNJ8ODG19yNug== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1f2bed9-d19d-41b2-1597-08d58db2eb62 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:01:20.3233 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0725 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masahiro Yamada [ Upstream commit 79e0348c4e24fd1affdcf055e0269755580e0fcc ] Drivers are supposed to set correct ecc->{size,strength,bytes} before calling nand_scan_tail(), but it does not complain about ecc->total bigger than oobsize. In this case, chip->scan_bbt() crashes due to memory corruption, but it is hard to debug. It would be kind to fail it earlier with a clear message. Signed-off-by: Masahiro Yamada Signed-off-by: Boris Brezillon Signed-off-by: Sasha Levin --- drivers/mtd/nand/nand_base.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.14.1 diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 21c03086bb7f..3bfa8e0e44cf 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -4780,6 +4780,11 @@ int nand_scan_tail(struct mtd_info *mtd) goto err_free; } ecc->total = ecc->steps * ecc->bytes; + if (ecc->total > mtd->oobsize) { + WARN(1, "Total number of ECC bytes exceeded oobsize\n"); + ret = -EINVAL; + goto err_free; + } /* * The number of bytes available for a client to place data into From patchwork Mon Mar 19 16:01:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132046 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2898252ljb; Mon, 19 Mar 2018 09:04:01 -0700 (PDT) X-Google-Smtp-Source: AG47ELtTGw4CIcbyOctF8nzj7+efalMIJPmR+Du6oR0IFe0qKxzKHRxVm6Y/qEY1KdwCBX92D0mh X-Received: by 10.99.97.149 with SMTP id v143mr9508576pgb.319.1521475441120; Mon, 19 Mar 2018 09:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521475441; cv=none; d=google.com; s=arc-20160816; b=qGcqX/XUQxAYvoyNaY8QoAPfoQiBZ8YKaE21gso1hzpen4Rp49sXIQ7H/UzrDVuifL BCVt0ET2Icax2SnxOhgbFkqQeQr5lWzdA/YJYy4T45WLeM760hyJgwDD/RKeARlL0+tb T0eXBsG/C+nCVTGag0+kXz7jeNETF5rbewZVWeeuWp4PHsTioJwEhbBM/YnwsEulaCAy t5M37dC2TKPt/2xk0r22pv+UMI8D3+LbL7c6PATPOlhSBpV3PCDyLntknbYxIQyS6mD2 2EFh57FoHe7RbrxS9tsJMyciukDZMf20Zu2xLJAhgtex6hkROGpbhtUZLhSuxVlugYjZ Q+Sw== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=tqG+1ikWfVXW+fjivo3v4djosD1DOP4+x+1E0+fArb0=; b=ITemKZD+YwUpf8L3NxhHirxqrLy0UnaYusdo1DN7BFt3nF2xBgIun/lCIl9YD+LTvB 89OPuGajEiOEGmadXI/tBwUntyHGvcWEACBbHUSWjpNdRXaxF8/UEazm8dSMFckf3mb4 F9Vrpy79J0fhBe7uM/CgDE3KobKFsnkaCLLX//mnQs9gN4Q98Z/YqBXGWgqRI8ebP4BN 0yl54qdqk+ut2pTYHfHywi2hD569UXkXDNbbPP+yj/ufMUbFcOcve7AX6wMvzPj7fCOe 6d/g9qFhPEWenBrTsjvo5FaKYgWVgEi4iOA08W7qRg3Vf/J7JW95cXTqptv1hREB0sf8 O1Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=NLVC+mub; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n16-v6si213653pll.669.2018.03.19.09.03.59; Mon, 19 Mar 2018 09:04:01 -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=@microsoft.com header.s=selector1 header.b=NLVC+mub; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965614AbeCSQD4 (ORCPT + 28 others); Mon, 19 Mar 2018 12:03:56 -0400 Received: from mail-by2nam03on0139.outbound.protection.outlook.com ([104.47.42.139]:32544 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965474AbeCSQDS (ORCPT ); Mon, 19 Mar 2018 12:03:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tqG+1ikWfVXW+fjivo3v4djosD1DOP4+x+1E0+fArb0=; b=NLVC+mubA3VSe0fWDSeik6Ee3AdDOMSM6q/fdawj32m767i+m8A2+c1eHzudfJ6YDJGJgqv6b/3nVhRhTHLfc6ghDAOxDFuUnd/NcNfNElCkTuDI8d9ZOyf1Sfv7XJIBDkJMOUyMbsqMGmOBPY38jwUEy0KQU6sl07PeiWwc0q8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0919.namprd21.prod.outlook.com (52.132.132.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:03:14 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:03:14 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Sudeep Holla , Michael Turquette , Stephen Boyd , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 177/281] clk: scpi: fix return type of __scpi_dvfs_round_rate Thread-Topic: [PATCH AUTOSEL for 4.9 177/281] clk: scpi: fix return type of __scpi_dvfs_round_rate Thread-Index: AQHTv5uGtHpaVywcdEyu1UMV/zRmWQ== Date: Mon, 19 Mar 2018 16:01:22 +0000 Message-ID: <20180319155742.13731-177-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0919; 7:99aAa6WYrQPqK9Ak/xeb50+w0mw468xtKna4rH0d2NtGMPTaxZXwcKQDt66ClloEHwSYyT2by5unyaGbIVBkU0isOdP8tm6HwZVvlaiq1j6Nu39pUxvxqpCKbP0/kmYT9a+S3ViKAH2JpYhundRha9FU3PK50a7Diae28hjs5rRqSsImGGeT1RsRDeh4oJZv0e08mm/fxFF6aFQwkKUpWkIuvl1Z2AVvJxXdupOH9GK3nv6nf/oADuJQLbwbp55i; 20:ROL8P3QITvAKGq07wgM0ztGSBDMcYaVvHiRy4jf5h7J2EvSCIb8lu5B+lUdu7arkKb7xbYXAv2yvvgDz/MwI4zSRAsnBCjMyI/4HSnacbIdUPTDClNHP1ugoCRaEY4olsZi9S5jclPiVqW6oNIZWWi16hCFE2YnkHyofDwbQzY0= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ce3d10fe-908f-46ae-116c-08d58db2ec1c x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0919; x-ms-traffictypediagnostic: DM5PR2101MB0919: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB0919; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0919; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(39380400002)(396003)(39860400002)(376002)(366004)(199004)(189003)(66066001)(575784001)(2906002)(86362001)(10290500003)(105586002)(8676002)(305945005)(110136005)(478600001)(4326008)(7736002)(81166006)(3280700002)(6506007)(97736004)(107886003)(5660300001)(36756003)(8936002)(53936002)(86612001)(14454004)(1076002)(2501003)(6116002)(10090500001)(76176011)(186003)(3846002)(5250100002)(6512007)(99286004)(102836004)(106356001)(72206003)(81156014)(2950100002)(6666003)(54906003)(3660700001)(22452003)(68736007)(6486002)(25786009)(26005)(316002)(2900100001)(6436002)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0919; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 9aroGOtT6OEwbspE0nKvC7tZFWg8nT10hz9b0V3StafM7kesnHCbwgquJTHnKlYk9jznerW0fH2adVWhzCbKHvAsUZnsevK+bZr9hDulY5Hfnq2+z0NVxHcKzNQnsZ0I36sjBcRt2RyCMP1KMa+VdaTL+3bQhniWmbmynoQ7JJFJ7xfTma2TtZFG4PDpMk9unzHxPtj2fxoWTEdq98zMzUS5QD7JU6QkNNdp2Q27F79S+UZz2mx8DKZMzN0lhcSIloGvqTXB0KNoOBSegFK6rh1qq3xQzqz8TyjlZBjOey5QmHAEQcPzpY+UaeMjvsz1bKckzDvwLtDdZJ+vgGIR7Q== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce3d10fe-908f-46ae-116c-08d58db2ec1c X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:01:22.7480 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0919 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sudeep Holla [ Upstream commit 7374aec95636ca39409545eba4ef5ff3125c2346 ] The frequencies above the maximum value of signed integer(i.e. 2^31 -1) will overflow with the current code. This patch fixes the return type of __scpi_dvfs_round_rate from 'int' to 'unsigned long'. Fixes: cd52c2a4b5c4 ("clk: add support for clocks provided by SCP(System Control Processor)") Cc: Michael Turquette Cc: Stephen Boyd Signed-off-by: Sudeep Holla Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-scpi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.14.1 diff --git a/drivers/clk/clk-scpi.c b/drivers/clk/clk-scpi.c index 96d37175d0ad..8ad458b5ad6e 100644 --- a/drivers/clk/clk-scpi.c +++ b/drivers/clk/clk-scpi.c @@ -71,15 +71,15 @@ static const struct clk_ops scpi_clk_ops = { }; /* find closest match to given frequency in OPP table */ -static int __scpi_dvfs_round_rate(struct scpi_clk *clk, unsigned long rate) +static long __scpi_dvfs_round_rate(struct scpi_clk *clk, unsigned long rate) { int idx; - u32 fmin = 0, fmax = ~0, ftmp; + unsigned long fmin = 0, fmax = ~0, ftmp; const struct scpi_opp *opp = clk->info->opps; for (idx = 0; idx < clk->info->count; idx++, opp++) { ftmp = opp->freq; - if (ftmp >= (u32)rate) { + if (ftmp >= rate) { if (ftmp <= fmax) fmax = ftmp; break; From patchwork Mon Mar 19 16:01:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132068 Delivered-To: patch@linaro.org Received: by 10.80.152.129 with SMTP id j1csp3111630edb; Mon, 19 Mar 2018 11:04:51 -0700 (PDT) X-Google-Smtp-Source: AG47ELsL9xZ1uOM+F0Yxq5/ijQt7QIV1EAZjZPKNXI3Sxzy8ZZp0SwTnEPxafH1tcDplevr+AfxO X-Received: by 2002:a17:902:b703:: with SMTP id d3-v6mr13157700pls.209.1521482691021; Mon, 19 Mar 2018 11:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521482691; cv=none; d=google.com; s=arc-20160816; b=FxQRi22XehlCSPNO/8yFmNgrmk9wl5YpWiZ6dry60SRYAbSQKwR9ncXONFuwr5xmjR LtmLAqvUWNir46M1EwaH4kWnq6z6mPhF+2nCTfpB6ilZ0F3YivGngfExjyz2Vc7ELpvt Au24lFJyqSTRyVlrMnzSjhSoB7vDhCGuaYT/o3ZcbRQL4KYOTt1jgKPf1e+VyM7uo77D t3HBipC+rnvbsh4d+6ULToXFSf96T7Tq9+NKuF+kRJO/ZixRUgcrjK36x9O76rNiZXm+ 6u/PrgbUVsp2yf9vDNPraVeRmlPnO41pq5DdBWR5FMnfWnFP6RrnxSy+eog9q8c/E6ue cTwg== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=7tytLtDOBJ5LLbNyfNKuXG8RVC+BsYgf/Vb15U5l/ek=; b=f3xQdNpkzJbSdfDjSNuos6JrCftP8akOm6hAoWoj2KlvwtqLW3aP7owW289e2GMjcL 9kuNDa++ySiJfnMg8meZ1EpKhxCb2d8JtwkWAUXYhTjJ2b2Gjo3ywfZ0AuzgxHVZJzLe j1v2FBL+izEpX+Qg7pcDv0QthsM2ELiK5vBhF7Orje/j2lgQ8Gy6IAgKjvQVDG6IKDLS vAEdPYupp3K7/W/U/7z/UryP5Til4bKPdF3HKMDhsVPN/vOxdEZ7dtX2XZL3QCNR2b60 6uNnrTctSl6zAqo5twGRh6o4BqsjpvW8hOvRRFDBDwNjx/XTFCF1dc1xwWUEab6BrxK0 ivRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Hppp06an; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b17si307404pgf.251.2018.03.19.11.04.50; Mon, 19 Mar 2018 11:04:51 -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=@microsoft.com header.s=selector1 header.b=Hppp06an; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968400AbeCSSEr (ORCPT + 28 others); Mon, 19 Mar 2018 14:04:47 -0400 Received: from mail-by2nam01on0098.outbound.protection.outlook.com ([104.47.34.98]:46928 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935039AbeCSQDu (ORCPT ); Mon, 19 Mar 2018 12:03:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7tytLtDOBJ5LLbNyfNKuXG8RVC+BsYgf/Vb15U5l/ek=; b=Hppp06ani0q1luAOGdKpUlhhz+4NOBWBllBHlj9mlx0fw0147UZt6O8WLfn9gt9s+NMykSgmo0GGP3aRS0HSqi4QAM+GWKkzRc2Z2Bs69mu5N5rMtlxIvscHT/+ykZULnLIgmaZ1ZzVJbNWNsDBpk8Gau59WAd3Z8vt4PKCIiG4= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1077.namprd21.prod.outlook.com (52.132.130.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.1; Mon, 19 Mar 2018 16:03:48 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:03:48 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Ard Biesheuvel , Will Deacon , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 184/281] arm64: kernel: restrict /dev/mem read() calls to linear region Thread-Topic: [PATCH AUTOSEL for 4.9 184/281] arm64: kernel: restrict /dev/mem read() calls to linear region Thread-Index: AQHTv5uMkPGhfWxvC0eqDvDM+I+3Kw== Date: Mon, 19 Mar 2018 16:01:31 +0000 Message-ID: <20180319155742.13731-184-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1077; 7:3Z6rTWAmpfaE99gYggAOwvTbeQMc5UI4suVPWjZrPhdwh6+K5lb12nBLypBNoMUPF4sAUJWBzO8Ah/K41VHr32nl34zDWN5S1X+AP2MmK7pz44eBh0GGoO3YOOwK83U8GJ2e1UbXyqU1xFRtFUFBpfQI6+3vVNBSFDkaBwmkJnC8E21GRHZi5LA73XcT46bRiN2+T0Zc9hQzboRIwiW6MmjW+tBsGXDzp2NaQHaiQ8x0VlvKbQnvna0k7uNd3APn; 20:oFr3gzr0S+y9bfr6opkWPfG2mg+g2N33ayTBS7vctfM0V7l+niA5hcA/22VARpY3kLNKwVRdawuSri5JEcrs/4dPkgvdmkIrWyAm3GNznlrozJGt2CiMn2wu1s7PYKAnnXkcvpPWLexuuGsUI4JAudrXs2aAHtRnpNRmLDdFVMI= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 2fd036d6-3e07-420a-d794-08d58db30036 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB1077; x-ms-traffictypediagnostic: DM5PR2101MB1077: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(180628864354917)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231221)(944501300)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB1077; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1077; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(979002)(346002)(376002)(39860400002)(396003)(39380400002)(366004)(199004)(189003)(110136005)(36756003)(3280700002)(66066001)(3660700001)(4326008)(6666003)(2950100002)(25786009)(86612001)(105586002)(10090500001)(68736007)(22452003)(99286004)(106356001)(5660300001)(7736002)(305945005)(76176011)(54906003)(5250100002)(97736004)(316002)(2501003)(3846002)(6116002)(1076002)(2906002)(14454004)(2900100001)(6512007)(8936002)(186003)(478600001)(10290500003)(53936002)(8676002)(107886003)(6436002)(81166006)(86362001)(6506007)(59450400001)(102836004)(26005)(72206003)(6486002)(81156014)(22906009)(217873001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1077; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: c9QaUzwrfnjknWvYyCJKEuCXl4oBUXhoWnBRwbdg079t5YcRv+qLBAjWybPYBsUBkKW5MphbpRpNe/hCVThNXWIJJP/seygz5GJ1JgIfEnaJOKY1iUXD762pvSn5dsSuEyAEXJk1vgIJqlImxNFzOhkmsL/oU2hDD+2QGXO8dTiq3l8xViEzsjmy4KOcqmA46xcLQFXejzcFsXoptJ2Jw0MHAw0gSEz6gRm1BfQlhXXREL/zDX9b/MzwdOZ5I3NHXpOuB3hPbNG/4dX4fh9hKQD5RDCMA0ZxSQpgnE7qZaESvi2LesTx7EKjsC78U0CNEaTEK26rndSyRkjsg7hUJA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fd036d6-3e07-420a-d794-08d58db30036 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:01:31.5844 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1077 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel [ Upstream commit 1151f838cb626005f4d69bf675dacaaa5ea909d6 ] When running lscpu on an AArch64 system that has SMBIOS version 2.0 tables, it will segfault in the following way: Unable to handle kernel paging request at virtual address ffff8000bfff0000 pgd = ffff8000f9615000 [ffff8000bfff0000] *pgd=0000000000000000 Internal error: Oops: 96000007 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 1284 Comm: lscpu Not tainted 4.11.0-rc3+ #103 Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015 task: ffff8000fa78e800 task.stack: ffff8000f9780000 PC is at __arch_copy_to_user+0x90/0x220 LR is at read_mem+0xcc/0x140 This is caused by the fact that lspci issues a read() on /dev/mem at the offset where it expects to find the SMBIOS structure array. However, this region is classified as EFI_RUNTIME_SERVICE_DATA (as per the UEFI spec), and so it is omitted from the linear mapping. So let's restrict /dev/mem read/write access to those areas that are covered by the linear region. Reported-by: Alexander Graf Fixes: 4dffbfc48d65 ("arm64/efi: mark UEFI reserved regions as MEMBLOCK_NOMAP") Signed-off-by: Ard Biesheuvel Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/mm/mmap.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) -- 2.14.1 diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c index 01c171723bb3..caf75abf6ae7 100644 --- a/arch/arm64/mm/mmap.c +++ b/arch/arm64/mm/mmap.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -102,12 +103,18 @@ void arch_pick_mmap_layout(struct mm_struct *mm) */ int valid_phys_addr_range(phys_addr_t addr, size_t size) { - if (addr < PHYS_OFFSET) - return 0; - if (addr + size > __pa(high_memory - 1) + 1) - return 0; - - return 1; + /* + * Check whether addr is covered by a memory region without the + * MEMBLOCK_NOMAP attribute, and whether that region covers the + * entire range. In theory, this could lead to false negatives + * if the range is covered by distinct but adjacent memory regions + * that only differ in other attributes. However, few of such + * attributes have been defined, and it is debatable whether it + * follows that /dev/mem read() calls should be able traverse + * such boundaries. + */ + return memblock_is_region_memory(addr, size) && + memblock_is_map_memory(addr); } /* From patchwork Mon Mar 19 16:01:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132067 Delivered-To: patch@linaro.org Received: by 10.80.152.129 with SMTP id j1csp3108631edb; Mon, 19 Mar 2018 11:02:37 -0700 (PDT) X-Google-Smtp-Source: AG47ELvF27NkA3ZhwRjbB1ZVBcRtEX1IQ5egZv5Mab81w9YnANLvZDcjKU0xM0eNMklDELzVmbro X-Received: by 10.98.11.145 with SMTP id 17mr11032156pfl.150.1521482557541; Mon, 19 Mar 2018 11:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521482557; cv=none; d=google.com; s=arc-20160816; b=KVL8GfbR3XifXrsvBG/urO022YwBa0FaPic/1h5Xl87HPwijAnQN1yMQQYVlCgAWmK r1guL/Y1c7pn91ERyGz1Vse+ZAji68vewdV+jJ3SdEGN2+Xbe5zFYDe/k0Yfbylc9iLV xcuxn/FSpGVhML9pjyafrqLBaL2xK3XxMoCtc+8VdtHzd5x1M5GLpUVyG6jX382GaHky Dqv6qWOmZ6Kvx1gE6yOIMtKutt07QiCDSn8lmfhu6dkr8qq3V4ZRW+/jZUk7PeMoqJg+ mKdIkWtQWFxPCetGUfWiZFbf8yhu84lpPKGnHts3xc0VKVLpGzf2KTBZfiWInVzbhJAm kIMQ== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=nb+iVCyDY5UG8klckSOK6TOuIxWuUYY7OL8ZkxKpA9s=; b=spLwMCXEOVotSc4Hbvm9eJJCrCxv8gYV+owVYqBf5yFxB0kpjo7+G6m/B4YoNp4q27 JbRRKcYHizY5bhR2UhM5r9zbRrc2bofygzj1NQPcCiuXuteJR8LgYEnORNytXWgZnpUv CDilXnboJH4JeDK9Hs9YfAopsbGzVigxPmRBlor4019Rd1JPj6Xnw1NinmkHyW9kUiSZ ajVcaCkHsc6Z9vd9ikuluwRvVBk77QKqkUBMmFzJv0enDEHSVdF+lYT9NunYhEeXqX++ lNoF4l4Z85ie8hAWofspmRo1kEID5bbobmEJ81iixeG9R4rZmSjTpOCHQ9K7o6eq/1aJ uq/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=mCOe1AgE; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si402702plf.98.2018.03.19.11.02.37; Mon, 19 Mar 2018 11:02:37 -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=@microsoft.com header.s=selector1 header.b=mCOe1AgE; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967814AbeCSSCe (ORCPT + 28 others); Mon, 19 Mar 2018 14:02:34 -0400 Received: from mail-by2nam01on0098.outbound.protection.outlook.com ([104.47.34.98]:46928 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965621AbeCSQD7 (ORCPT ); Mon, 19 Mar 2018 12:03:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=nb+iVCyDY5UG8klckSOK6TOuIxWuUYY7OL8ZkxKpA9s=; b=mCOe1AgEmr/BSwBzkAdh8p6RrOB1vUUKqSdd6TlFARvCHxBzfYylKzOMovdDN7qcCujAzLuSXurTB5WZUDO1NC6EVVAqHP3H/bbiVVbyHxQhDju0ZQk3Bm57o0agLaOEjtnRhC9VV7XLoiLbrsQGXUjYQVgA0I/xpeWpgTgOFD0= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1077.namprd21.prod.outlook.com (52.132.130.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.1; Mon, 19 Mar 2018 16:03:51 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:03:51 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Tomi Valkeinen , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 189/281] drm/omap: fix tiled buffer stride calculations Thread-Topic: [PATCH AUTOSEL for 4.9 189/281] drm/omap: fix tiled buffer stride calculations Thread-Index: AQHTv5uP1sk4NU8/t06zbKJwZr0tmA== Date: Mon, 19 Mar 2018 16:01:36 +0000 Message-ID: <20180319155742.13731-189-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1077; 7:CJsmzA5gBmdwMFAc0zd381BCQS7L1DQmoT6yR9bVgD71rzCutFYXi3FxNXJcpISBVaGHq6iaXThy0f3x0rFKF90+7b0hw+mpcRyszZ57bZzHA0s7yBmtxs34uXZFeNXH8HWYXE+kuRflWkzrPmi7VxvYFQL4l8tOluRGOCgDvSOKuBK7YdKCbXJn/eIv7P0G/1Wp+GR4U50RM31XAwSXYAv4aiiTGpA4i2z6dfNb6jdtTUg6ROUCQHU2ZUUpPB5M; 20:6jX48nDp34tVwq3TnhUwU8k1a/NOFtDSK/oMPZLMW/rWZJwRv2Yx0zwD4ssz+TXMQ9kduZK+SXGmEcHTwv8JKZHge7YeXSic5Khr0BiEtwbAc6UHawEhuOZ45Ypu7VOjAddmiBBGOrnnt+XEiHjc8Fnh/AOazvudDyt1WxiSctc= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: abe234c8-5670-44d0-645d-08d58db30248 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB1077; x-ms-traffictypediagnostic: DM5PR2101MB1077: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(31051911155226)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231221)(944501300)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB1077; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1077; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(376002)(39860400002)(396003)(39380400002)(366004)(199004)(189003)(110136005)(36756003)(3280700002)(66066001)(3660700001)(4326008)(6666003)(2950100002)(25786009)(86612001)(105586002)(10090500001)(68736007)(22452003)(99286004)(106356001)(5660300001)(7736002)(305945005)(76176011)(54906003)(5250100002)(97736004)(316002)(2501003)(3846002)(6116002)(1076002)(2906002)(14454004)(2900100001)(6512007)(8936002)(186003)(478600001)(10290500003)(53936002)(575784001)(8676002)(107886003)(6436002)(81166006)(86362001)(6506007)(59450400001)(102836004)(26005)(72206003)(6486002)(81156014)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1077; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: T37hc7G9LgBoyM/KaWslyCzaU/iLQ37PXUmMdo8eoOiDXYIr0n+3AVbQWbi1vkH8ac2kL+HADL38Eg04vevETFe8HI9VUbNAj9x75YCnXIGensVnH1caAOEY4lRZXknXIHvr+RjOQ5OKD7uj5EtNUd98KliJ5mmfzKhXDEIjvo0vawEOUFMVcso/ZIGZI7fsoHGieMdvU93+5LqAUsW8NaVf+320RlcMg8lFBk40ES8faFmrhOP//QmjIJejga0FicvhJGow7+x/eXeVSH4t46GPPepL8QyhS34U9EHMI6+v8tj911LnPRJtDWVddn2S5vvNnb3Isdb2vdfMZErLCg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: abe234c8-5670-44d0-645d-08d58db30248 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:01:36.9962 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1077 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tomi Valkeinen [ Upstream commit cc8dd7661ccc2d8dc88921da8e6cc7c2fcdb0341 ] omap_gem uses page alignment for buffer stride. The related calculations are a bit off, though, as byte stride of 4096 gets aligned to 8192, instead of 4096. This patch changes the code to use DIV_ROUND_UP(), which fixes those calculations and makes them more readable. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Signed-off-by: Sasha Levin --- drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.14.1 diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 505dee0db973..ca91651be3d4 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -195,7 +195,7 @@ static void evict_entry(struct drm_gem_object *obj, size_t size = PAGE_SIZE * n; loff_t off = mmap_offset(obj) + (entry->obj_pgoff << PAGE_SHIFT); - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); + const int m = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE); if (m > 1) { int i; @@ -442,7 +442,7 @@ static int fault_2d(struct drm_gem_object *obj, * into account in some of the math, so figure out virtual stride * in pages */ - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); + const int m = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE); /* We don't use vmf->pgoff since that has the fake offset: */ pgoff = ((unsigned long)vmf->virtual_address - From patchwork Mon Mar 19 16:02:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132066 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp3005159ljb; Mon, 19 Mar 2018 10:49:46 -0700 (PDT) X-Google-Smtp-Source: AG47ELsrhsiykLPZsBnT92CmULZ8epdnblioHkCWSvlccTMIpTqC44ggqdaBlhN3yJg7L8w40qnS X-Received: by 2002:a17:902:9349:: with SMTP id g9-v6mr11033400plp.243.1521481785920; Mon, 19 Mar 2018 10:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521481785; cv=none; d=google.com; s=arc-20160816; b=QYiyVflBG9cX0QPLyVEt1Wvb2Q5+8XvkNQoSoomAK0LzKotsqU41u0Dw9VN6xtOgSn rwarsqwWdxfdiw0jShnDWVmBG0nrMesPDoH36nQRay3q0+GH63kA8qbVXMXBrKwNdaom sZ3Kceqli/odwwvHl5epokC0WB+Hn2kUyjhhh9pP3kBMxO7cLWfQuqDLqc0BkTb65Z+h qcDa9MIQiC+ezcYUCCrnSmOGm3/v+JUiBJLe+4faumwdNz6mSkqVfkdV9AHNRidT8I7M QXf8/trpT/zsu6h6lfzYhEG3SC3QTUhlcjy9a/CABie5cE7qxm18ZVCc3eij+DgPqZ7O rhNA== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=jrElcw7FqZ9WKYkEX6lVv/ROCK1Qz+WvxzYGLDm6Zs4=; b=c0TadpG6vg+PDNPZbcNK9AFe/O13ghQq85bJiTkGnBgCJGJEh2otkh9CR4WccO2gi0 F417mb/9O4TdrbeZGrIr2d7o9PiDMjqJhVy5KRmN/FaADFqWacBdWxmjah5RRCwbO0vt chU9VdFckfDo5qa1wtKILIhsoJ6ddmBQ0a9uhVhTihcfZHLgppxbep2Me6qR+iD96UXa w/9aHyb7v1lO3GBuoSYgL+vMVXuBIWdmN3okF37T0wQIhDk8nA4W3VkCsJOqpqqL6dJT Ub1EH/vM40pPFKVjvloxLy0pk6FpGV/9PmYfO+OfYpvJlo+nC+pid5qoNdnTkuFBX2oY 8qeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=cOlxyII6; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si288093pgc.296.2018.03.19.10.49.45; Mon, 19 Mar 2018 10:49:45 -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=@microsoft.com header.s=selector1 header.b=cOlxyII6; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968272AbeCSRtm (ORCPT + 28 others); Mon, 19 Mar 2018 13:49:42 -0400 Received: from mail-co1nam03on0134.outbound.protection.outlook.com ([104.47.40.134]:7948 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965675AbeCSQFC (ORCPT ); Mon, 19 Mar 2018 12:05:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=jrElcw7FqZ9WKYkEX6lVv/ROCK1Qz+WvxzYGLDm6Zs4=; b=cOlxyII6A8fbz+RaIcn/6a8GvNiJVwfLdJsrCpC2JlgBB87VFi+pwnVaG016z2d2+oN0Tf1CUsP3do6n4ajEncyjHmi2MGdJuZUG8fQ5bkakFvpAD4hRHCcbkBSNjHyM8AhkctVB7mybgfp55Mz9hfb9sly3MI6s/aXs7rq4Sro= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0885.namprd21.prod.outlook.com (52.132.132.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:04:52 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:04:52 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Arnd Bergmann , Ian Abbott , Stefano Stabellini , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 232/281] xen: avoid type warning in xchg_xen_ulong Thread-Topic: [PATCH AUTOSEL for 4.9 232/281] xen: avoid type warning in xchg_xen_ulong Thread-Index: AQHTv5uu2nV7b403cEKyB9DV7+TdOg== Date: Mon, 19 Mar 2018 16:02:29 +0000 Message-ID: <20180319155742.13731-232-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0885; 7:8CyQ2B6K55Ad2sl6YPZkPk96znN0SJrpX6M7ku4YD8nkOQ/RmUkRCs5W5TqbuIYCSi5XP/ljaUq5cTgbV+/5tUEkP0eXf0QZ+jTeC/AM/S7726lZoD8Ub+IPxJuhRR1KqCDPoyC4m0w5FKWWF1gqYDI1hS1aLf5S+ONEbc0Y9dubPZDohwsWKRAFY0MipUwNwsy++jQAmmGziUQ6TgD0++OoIRMw1o5j3oF8TfGiTW9XyJSQpfKEOW8p5ysjZcF9; 20:Sgr/G+7tj7xAlZeARbvGz1k3geDRjGCZc5bfAd/6He/k9dwd2lXWGBxTMI0kP71ZyF30tjhp8hJUytL/fQQrmMkdh4Az+3rNiWTgr2QOwN8oSE5u8rq+iC8lRCp2HZ7O8esjAUyvnEDL1sNyvFndPPzo4Hx8uGLRoyGhjWLz0KI= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 94c21027-3158-4c93-3fc8-08d58db3261a x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0885; x-ms-traffictypediagnostic: DM5PR2101MB0885: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB0885; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0885; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(346002)(376002)(39380400002)(39860400002)(396003)(199004)(189003)(6666003)(8936002)(99286004)(3846002)(107886003)(2900100001)(68736007)(14454004)(6512007)(72206003)(81156014)(81166006)(105586002)(4326008)(25786009)(1076002)(22452003)(86362001)(110136005)(10090500001)(54906003)(53936002)(316002)(66066001)(6486002)(106356001)(6116002)(6436002)(2950100002)(3660700001)(8676002)(36756003)(97736004)(102836004)(2906002)(305945005)(5250100002)(478600001)(6506007)(59450400001)(7736002)(3280700002)(5660300001)(26005)(86612001)(10290500003)(76176011)(2501003)(186003)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0885; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: dsc9NMxdZF8ROiC6D+Llz95InFP+Hci584nW5rib6zdBDnyTg5nZtnLxl3xfI34z3UMy2Jj4B/mVnUfNn7LxXQYtDp60JZhGflXtFaUZsJ4cmj/Uj8ot0+vXUY1lRehI8ZpAyTPxby35+UxwM6LWG8vqRr3Ov3IbGE14fohk1XBENelmyFVmpdS4dLcC/ROMkhp8840+31muCrq17ybGzqh2sumFkm0D+NP2yP8piSNCI/iiOMvf/zqxhkjb02hbXfsjFyWlrTrFOAgqy4R6KBUNXphEtrMAb5YTM0ZALGUmh/77H8xUXgCkgnRVlJRLAMbDlnMNtdNKBrL9hSP+Wg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94c21027-3158-4c93-3fc8-08d58db3261a X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:02:29.2458 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0885 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit 9cc91f212111cdcbefa02dcdb7dd443f224bf52c ] The improved type-checking version of container_of() triggers a warning for xchg_xen_ulong, pointing out that 'xen_ulong_t' is unsigned, but atomic64_t contains a signed value: drivers/xen/events/events_2l.c: In function 'evtchn_2l_handle_events': drivers/xen/events/events_2l.c:187:1020: error: call to '__compiletime_assert_187' declared with attribute error: pointer type mismatch in container_of() This adds a cast to work around the warning. Cc: Ian Abbott Fixes: 85323a991d40 ("xen: arm: mandate EABI and use generic atomic operations.") Fixes: daa2ac80834d ("kernel.h: handle pointers to arrays better in container_of()") Signed-off-by: Arnd Bergmann Signed-off-by: Stefano Stabellini Reviewed-by: Stefano Stabellini Acked-by: Ian Abbott Signed-off-by: Sasha Levin --- arch/arm/include/asm/xen/events.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.14.1 diff --git a/arch/arm/include/asm/xen/events.h b/arch/arm/include/asm/xen/events.h index 71e473d05fcc..620dc75362e5 100644 --- a/arch/arm/include/asm/xen/events.h +++ b/arch/arm/include/asm/xen/events.h @@ -16,7 +16,7 @@ static inline int xen_irqs_disabled(struct pt_regs *regs) return raw_irqs_disabled_flags(regs->ARM_cpsr); } -#define xchg_xen_ulong(ptr, val) atomic64_xchg(container_of((ptr), \ +#define xchg_xen_ulong(ptr, val) atomic64_xchg(container_of((long long*)(ptr),\ atomic64_t, \ counter), (val))