From patchwork Mon Dec 16 17:47:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181779 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4663424ile; Mon, 16 Dec 2019 10:15:01 -0800 (PST) X-Google-Smtp-Source: APXvYqyRMuRzlj1L29PITnbTHOYbILkD0DDf/kLKcqm79o66qKD4KWq+6Y5N6oxIuVg/N24Y5gD2 X-Received: by 2002:a05:6808:2c9:: with SMTP id a9mr197752oid.129.1576520101092; Mon, 16 Dec 2019 10:15:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576520101; cv=none; d=google.com; s=arc-20160816; b=xh525ebYy+e1ZkIoSY+fJOkkwHNc7FJfweBWtC/ZmWx5iTC0tppi8voxNsV+kIBAFh 1vFT/7HFqxpjII1tgVEzSPP8V3PTH/mEL5i+tpftz9Y/uQAANMaTOIOHuYxPgMMm6wz4 oonadZg6uVgK0rBz7TWqCBaQ+R2fVkApx/ESi6xbUJtfQAdKKCIeFxJarW2wPeLE7uJ8 Nw6Oa73RsRbd9eA6/G1BqP9wyjDbK/EKoKqj3AoodswFm65woLNx/9nNxZ5JLBv/SiyA kgPJ0sMY7pflHIfF6u1lmLlNndlsgxBjTmFWv3XKgg6S07v2htq6cylXkM+epxyKjQNd MYGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t54BQFK7HbgmhEhXEkmlJJ0p17r3TkzLBKXe4eS5Yn4=; b=yZueC2fLt1rzppnTOofHQwSDIqsPckkfq7Am3KcdZEXx9RmoesltmVdJYeqf5WIGPc 5QiqmX8sjfwmQ7oNMaUHZGPiMUQm7eo1TIk3Y//LVoo/xWzi7Bc54TK38juQkCrpm+sQ SBWLk6S1LNNgQvxoGSvOXLptF7VHONe0xWtaBTCXErApmVoNY5sKLYvy5w8Tks4hdwPj auuUkymr5PRgT8mFSgSqVe5gRJ1oaXmcRuYLzNvpIQyjxdMqcF8MWfCwSUFsUyaLC2y4 zKRMvwvrQfgTnUMAjmdukSMPA5HWRVLTGBBMv4EA/lW8s2qIUiKsd0CVefp6rkcQzLAg ekZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BDdj+d90; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i185si10932274oia.187.2019.12.16.10.15.00; Mon, 16 Dec 2019 10:15:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BDdj+d90; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731019AbfLPSO6 (ORCPT + 27 others); Mon, 16 Dec 2019 13:14:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:34854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731287AbfLPSOw (ORCPT ); Mon, 16 Dec 2019 13:14:52 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC3F1206B7; Mon, 16 Dec 2019 18:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576520091; bh=8YgSHoChGKb32phfLg5ZQTsqIzhR7xPMg4wCjFtEORM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BDdj+d90C+57NQOYUAwW3IWgjyvxhbtF8ELy61LBliEepTAnAqwM/AN/dglj918O7 ukNBw1XnAhQhAObi+3spN+Z96x21ku/o26d4497274ovIxE+tSAGpB2ciGXh5R2lbK ybG762e1EQKdsw96gHSZJ4UFxllEyhjUBczP+hmI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Stanimir Varbanov , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 013/177] media: venus: remove invalid compat_ioctl32 handler Date: Mon, 16 Dec 2019 18:47:49 +0100 Message-Id: <20191216174815.592680330@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191216174811.158424118@linuxfoundation.org> References: <20191216174811.158424118@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann commit 4adc0423de92cf850d1ef5c0e7cb28fd7a38219e upstream. v4l2_compat_ioctl32() is the function that calls into v4l2_file_operations->compat_ioctl32(), so setting that back to the same function leads to a trivial endless loop, followed by a kernel stack overrun. Remove the incorrect assignment. Cc: stable@vger.kernel.org Fixes: 7472c1c69138 ("[media] media: venus: vdec: add video decoder files") Fixes: aaaa93eda64b ("[media] media: venus: venc: add video encoder files") Signed-off-by: Arnd Bergmann Acked-by: Stanimir Varbanov Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/platform/qcom/venus/vdec.c | 3 --- drivers/media/platform/qcom/venus/venc.c | 3 --- 2 files changed, 6 deletions(-) --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1412,9 +1412,6 @@ static const struct v4l2_file_operations .unlocked_ioctl = video_ioctl2, .poll = v4l2_m2m_fop_poll, .mmap = v4l2_m2m_fop_mmap, -#ifdef CONFIG_COMPAT - .compat_ioctl32 = v4l2_compat_ioctl32, -#endif }; static int vdec_probe(struct platform_device *pdev) --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1235,9 +1235,6 @@ static const struct v4l2_file_operations .unlocked_ioctl = video_ioctl2, .poll = v4l2_m2m_fop_poll, .mmap = v4l2_m2m_fop_mmap, -#ifdef CONFIG_COMPAT - .compat_ioctl32 = v4l2_compat_ioctl32, -#endif }; static int venc_probe(struct platform_device *pdev) From patchwork Mon Dec 16 17:48:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181780 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4664419ile; Mon, 16 Dec 2019 10:15:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxk7j1eUGfzbtTyuLpaCMYAQ9DLOA/yEwhjjRUWkT0dRsp4c0cZbZ6h3xqtH/RhMd7AoRv9 X-Received: by 2002:a9d:3677:: with SMTP id w110mr27230603otb.139.1576520149682; Mon, 16 Dec 2019 10:15:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576520149; cv=none; d=google.com; s=arc-20160816; b=UT4VAo3Bq61hoIopQD77qCq5uT1ucS/3Zet2r2+nBnX13WJlcZLrYtXQX8/Cdr0Eg1 acN6HLDZzxWilYrgzbmjVgej72XCTVL6UKol8zrDia5YoQsmqE1pAAY9s9r6XPf+80I4 aDjpcSULXMSN+irMTLTPFq6O3ZsuWo9bxvnNlgvJoUxxejYJOe6RYvMRJ5+Zp6f9WXJx /0iSIxr2iUzsxoHzacU9Ztbl7+BfUO+nC0oDva/aeLNsF4CTl2nc7bQHvxxugPDg8KPB 9o/RNsazVtkvwEXzPkDTPGnTYPiTKW8Sp7o8Jjt1g7MtTJ+EPsq0mmdAlNQfZLkhLp2+ veIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5qzGNrqeYmF5az6W1zLRq9O51eI3ByAnVA2nmhYBHeI=; b=AJQ1VC3Cqxs3yI5gqUB/h+a9JLSedQlWI6E0FhPtOYA8aXcMi0nZeGKXWIqbniCus/ Sw4OVzQ3UNEkWw0suH4V9g0j95g7sMG1yh0LjceZVZ6Z+bWq4dTfSNUoXMn2QIX4Vnvg 1dLJ7fRE7bJeNZUJZ2X33v+bY+svDYL72YnGxkuwcuFjGXXD1GyZOOzA3kt8ZY1ztCO3 yhnFDy5AQdu2OigWp0uRpQC1MSpBP+uuUeSbjWO8kY11ohWSJbZhNX6Rp+3F6cGJNMLS o1uwsAl/KQlJz33pmd3NwlV2iKA2M1DbdCEZsRzNB3mp3QTdCR/DYZW4dRXcjpDoJx0f m7qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XIRok3IZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si11178741otq.28.2019.12.16.10.15.49; Mon, 16 Dec 2019 10:15:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XIRok3IZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731434AbfLPSPs (ORCPT + 27 others); Mon, 16 Dec 2019 13:15:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:37216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731423AbfLPSPp (ORCPT ); Mon, 16 Dec 2019 13:15:45 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4B909206E0; Mon, 16 Dec 2019 18:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576520144; bh=p/wBT6mWqigW85wIsm9D/fhIeRga+NgjGzKYgeSLtn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XIRok3IZ3MhfvbcuU3t1n6QipUTVIIHslY7MTXu8TLXWF+4CTtWtUikon6CpR3W11 Wg9yW9GGwN6MNNBWNRxu06z2KE2h+h1cCS21hHBd+JE6WnK9zbOiknsg863LpCwQkA cUFmWTjG4pRE3epE2jCLCXkS/1Gfzt4SZ4cJv9yg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Bjorn Andersson , Georgi Djakov Subject: [PATCH 5.4 033/177] interconnect: qcom: sdm845: Walk the list safely on node removal Date: Mon, 16 Dec 2019 18:48:09 +0100 Message-Id: <20191216174826.474653116@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191216174811.158424118@linuxfoundation.org> References: <20191216174811.158424118@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Georgi Djakov commit b29b8113bb41285eb7ed55ce0c65017b5c0240f7 upstream. As we will remove items off the list using list_del(), we need to use the safe version of list_for_each_entry(). Fixes: b5d2f741077a ("interconnect: qcom: Add sdm845 interconnect provider driver") Reported-by: Dmitry Osipenko Reviewed-by: Bjorn Andersson Signed-off-by: Georgi Djakov Cc: # v5.3+ Link: https://lore.kernel.org/r/20191212075332.16202-3-georgi.djakov@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/interconnect/qcom/sdm845.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/interconnect/qcom/sdm845.c +++ b/drivers/interconnect/qcom/sdm845.c @@ -868,9 +868,9 @@ static int qnoc_remove(struct platform_d { struct qcom_icc_provider *qp = platform_get_drvdata(pdev); struct icc_provider *provider = &qp->provider; - struct icc_node *n; + struct icc_node *n, *tmp; - list_for_each_entry(n, &provider->nodes, node_list) { + list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { icc_node_del(n); icc_node_destroy(n->id); } From patchwork Mon Dec 16 17:48:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181787 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4677496ile; Mon, 16 Dec 2019 10:27:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzLyjEhput5+VvT72eg3/l5n5titZUBVvvkeQB6RoLuRn+pgH/l8NU3GQR+V//XCgQ4/SeY X-Received: by 2002:a9d:6395:: with SMTP id w21mr33732397otk.3.1576520851320; Mon, 16 Dec 2019 10:27:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576520851; cv=none; d=google.com; s=arc-20160816; b=V0v6GVr36dtV/090nGRl75ESmMW8wbE3sINe+JNx7UNHosEPKUQgz+9uIGhH9klad3 Mz732U45sN51b8lnkMpZ4u+UpXh7Y2gJe0rqTwYg0pEuCAc/0WD2J/tUJafQPwrAQNu1 3DOSZ6IEXsb30iC+I8ilHvK6xnMvvW9QSGXiF+vZtlR3O79yQEb4bwz07jwOaJlJeq0r Bpf2yiLByHIf/JlUBw7EbZcCWPPqZbw6hFHlL7N2aXB7Z50loPD7m5NmEds2ly8pSDHU 9HnwI49IiUF3hFAaqxWl/HDaFedVXpnuIySjqxdtBAjA9mMlNKhVKX1OSd5LLu3Tc4N8 0Pig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BE75oADoImC1BV+/Ce/iPvRi8JafoJqx48gBoloWcOE=; b=FWfMMpCqMSeDPHzUbLf7pY+hwqCa5n8U7Qv4vu4lap//9jQKvMvLLEoPbJRKWbi3JC aaHlYjJq/4Ysy9yKJGKP+AFhf8laSh6dWbKHYpqiWIc9EZ/CARR6P9HIa+4NLRKS/D7t zaTiFTd/zeVPKMQMq02PdYDJF7FnzN1haJ0516IulU/JFyM806cTsx/xdcW48ygHHY+R wzve+4tqWNYhml3TzexUPDESA5+CtKgCr4Z9ZaapK5UnbysLzhKNOoOLkn3KZsmzys+o AtHB3T8HRRn8mXgjW9V6xcHYfq2kQF92Zz5usMWY6n5YbHdDQTtWdIrFgNcdpGiGl80Y DfDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OgtUP2OY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si14568923otk.151.2019.12.16.10.27.30; Mon, 16 Dec 2019 10:27:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OgtUP2OY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727604AbfLPS13 (ORCPT + 27 others); Mon, 16 Dec 2019 13:27:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:37356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731227AbfLPSPr (ORCPT ); Mon, 16 Dec 2019 13:15:47 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AB25E21739; Mon, 16 Dec 2019 18:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576520147; bh=tHbKCpPiGecCPTCgk3V5tn9r2fHfaJe0rvIkRctlIjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OgtUP2OYOC6AJcdiuVCAg1NiRGRcvcJw34yQP2Ai3aukBvdeDTS9EhhWxugA9Nq6I 5YOn4s82p+yUUwJN2Fp6RF/5OBIK4Si6UDYuDfvf1fEaSv/OFBVM2pgKJ/NZUvlOUG M9YNHyrcpEDLdldYf02ivVhd0RNWaRtTWndr90iU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Bjorn Andersson , Georgi Djakov Subject: [PATCH 5.4 034/177] interconnect: qcom: qcs404: Walk the list safely on node removal Date: Mon, 16 Dec 2019 18:48:10 +0100 Message-Id: <20191216174828.234103663@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191216174811.158424118@linuxfoundation.org> References: <20191216174811.158424118@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Georgi Djakov commit f39488ea2a75c49634c8611090f58734f61eee7c upstream. As we will remove items off the list using list_del(), we need to use the safe version of list_for_each_entry(). Fixes: 5e4e6c4d3ae0 ("interconnect: qcom: Add QCS404 interconnect provider driver") Reported-by: Dmitry Osipenko Reviewed-by: Bjorn Andersson Signed-off-by: Georgi Djakov Cc: # v5.4 Link: https://lore.kernel.org/r/20191212075332.16202-4-georgi.djakov@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/interconnect/qcom/qcs404.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/interconnect/qcom/qcs404.c +++ b/drivers/interconnect/qcom/qcs404.c @@ -414,7 +414,7 @@ static int qnoc_probe(struct platform_de struct icc_provider *provider; struct qcom_icc_node **qnodes; struct qcom_icc_provider *qp; - struct icc_node *node; + struct icc_node *node, *tmp; size_t num_nodes, i; int ret; @@ -494,7 +494,7 @@ static int qnoc_probe(struct platform_de return 0; err: - list_for_each_entry(node, &provider->nodes, node_list) { + list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) { icc_node_del(node); icc_node_destroy(node->id); } @@ -508,9 +508,9 @@ static int qnoc_remove(struct platform_d { struct qcom_icc_provider *qp = platform_get_drvdata(pdev); struct icc_provider *provider = &qp->provider; - struct icc_node *n; + struct icc_node *n, *tmp; - list_for_each_entry(n, &provider->nodes, node_list) { + list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { icc_node_del(n); icc_node_destroy(n->id); } From patchwork Mon Dec 16 17:48:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181786 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4675745ile; Mon, 16 Dec 2019 10:25:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyLC2rvaoaqX0Z18r8km58LTVhv52NEnhVVAvG/K76R1xI5X9edh+9itpS5Sxeuis0M8K3F X-Received: by 2002:aca:4712:: with SMTP id u18mr222476oia.93.1576520749897; Mon, 16 Dec 2019 10:25:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576520749; cv=none; d=google.com; s=arc-20160816; b=PxJQMc+SUsHPRCUQrNTwdJbh+kWiBu1AksVUsKI8aVhqa3XcT5eLBKCQA8KT8Af7Hx 3VQesRQgXbHcWQWXNZHmtTtBTBWbBLN2EHMwEPp2ztzuKUZTlCdBoNFghHyhJXZF8WiC IfAUUgS3aQSKIHtwxIvf2iV7in5KLGhSJ1NYj1XS93E6Jgs0dlBnxJSB6/U3ICbF757b 3qrJsZr6JouYc6Z9qhHjnpbrUfm+dbdT4EX9G+G0EJU71sKz7g42lwSi4MERks53ylMw io0afYRq9rbh3+JDUgct5cLBOdvpSGOKfjs0AsytlsSNUXq27qBJKmtycqmvI5UiVSm9 dGyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MZf+Xw64B9aCTBHLkgJQHu3FWLkjCSyCcecHZ6GD+dk=; b=a8bteXVYdICgmwM1HrDmwS/Pk0AEWnTyi5FSVU7+YLkllYFEmJqlhV6BsuY6TpQVUK qIm4kD6yH/DMKr7hVUav/E5MlFn0fHNmiH6uK1/u5Ai7YF4KL8gJK+TLHsNSqC0pWYSi 04o9CBoKhJLWTdbBcCd3RdSyOVDA8neraEXV+/4QRqj+g9PMUPTJOFCAU7nt0Gk6Uw0V DAr2I5KKdLceNTYym/MLDTB6shTuB6y6AvRT7FxBcoZ29pHHEhIw6TavssNJHC82QiwM VUrSxunFQhxLvAp7WLEJDIxzwrw7Z3NpigO9WUjiPlOB15hQiR7wzrkQp63YUc3mAKT3 HOHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Lmom3sP4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16si10939311oih.154.2019.12.16.10.25.49; Mon, 16 Dec 2019 10:25:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Lmom3sP4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731892AbfLPSZs (ORCPT + 27 others); Mon, 16 Dec 2019 13:25:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:42278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731496AbfLPSRr (ORCPT ); Mon, 16 Dec 2019 13:17:47 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 54E5C207FF; Mon, 16 Dec 2019 18:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576520266; bh=QBrHzF/bDur2YZKXK3pZ0+nH4CtHkNb06QOzdb7jU/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lmom3sP440Gbbom3/8CzNIhDsJnvRBLhePANfqaxSOx3dVQBPek8OB9TcFhMz9Olc OyyVoMUtRkVl+Gru7oNK8nYs0uNY6xtYHS5ExFHJoKEB+BxrrzVhQB2EYnDvWKUXeL Tyu3HTXpw2vmi8jiY4WfUGSxakEIVauPmQb8X0v0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sumit Garg , Herbert Xu Subject: [PATCH 5.4 082/177] hwrng: omap - Fix RNG wait loop timeout Date: Mon, 16 Dec 2019 18:48:58 +0100 Message-Id: <20191216174837.647919779@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191216174811.158424118@linuxfoundation.org> References: <20191216174811.158424118@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sumit Garg commit be867f987a4e1222114dd07a01838a17c26f3fff upstream. Existing RNG data read timeout is 200us but it doesn't cover EIP76 RNG data rate which takes approx. 700us to produce 16 bytes of output data as per testing results. So configure the timeout as 1000us to also take account of lack of udelay()'s reliability. Fixes: 383212425c92 ("hwrng: omap - Add device variant for SafeXcel IP-76 found in Armada 8K") Cc: Signed-off-by: Sumit Garg Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/char/hw_random/omap-rng.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c @@ -66,6 +66,13 @@ #define OMAP4_RNG_OUTPUT_SIZE 0x8 #define EIP76_RNG_OUTPUT_SIZE 0x10 +/* + * EIP76 RNG takes approx. 700us to produce 16 bytes of output data + * as per testing results. And to account for the lack of udelay()'s + * reliability, we keep the timeout as 1000us. + */ +#define RNG_DATA_FILL_TIMEOUT 100 + enum { RNG_OUTPUT_0_REG = 0, RNG_OUTPUT_1_REG, @@ -176,7 +183,7 @@ static int omap_rng_do_read(struct hwrng if (max < priv->pdata->data_size) return 0; - for (i = 0; i < 20; i++) { + for (i = 0; i < RNG_DATA_FILL_TIMEOUT; i++) { present = priv->pdata->data_present(priv); if (present || !wait) break; From patchwork Mon Dec 16 17:49:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181782 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4668291ile; Mon, 16 Dec 2019 10:18:56 -0800 (PST) X-Google-Smtp-Source: APXvYqyeyGtfmODRiyyYRuWzPZfEiTnsliBYItDFGCX6TgZxt+nNjbTiq8kq21vqjldIv54Eb/tx X-Received: by 2002:a05:6830:22e2:: with SMTP id t2mr33922174otc.129.1576520336790; Mon, 16 Dec 2019 10:18:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576520336; cv=none; d=google.com; s=arc-20160816; b=qv18lBdyDBZlfZfRUEcdFlCVrUljcA3A69MQMnHJhPaM2vz3/0csTlNH01xP89bCuw vm2fzWOFDZ7zRBMihE6ksMtDVXxMvXY/7TaXzGliZ4IpC+31EoaPHq5dRvsm3NgfSirv AAuLyC+6RgHNv8Xg8+VpDlcHw25ffzrsT8mXMeAUy0HJ02+KlWxEnQUr6nFlq5m/7J4t s7pGU3Ra8M59kWYiqnaFxM76MZyINrSIfb46DTwVyXmRioQ2+QoQRBfqWZV1PGQ1kIyJ kZ+CegXPqWiYYvFWFWnxw6IpaUAVUY/736Gw0UFPO5QU2o21Q+kZvm5g53kYZeiohX2c W5TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sCqV9Ik5IKoyORTKqXxipUz6fJ8pV/YGfRYVbNvnfmo=; b=leMPZoU+Hy6vkiOvfrfWRrHPF5tUOfY/J3SOdjc//vZcn1ahII21EO2F/ou2t3aH+g EptJcF6QFQrHl1ciPv+ajn/5Gs0K03fRQQPWw+5Ppskn31LdctGA80ep5Plk+7UA8dwN s1EyzrBXEUITpy4PJB/USSkxVRQsEDmf0OODK9NPMVraaLINXMTXdRO581uSsGWK8wdz YSEjgkMVG+sgpxQGSTJ8qrPItn9ezkY2HFVofZbIzLCUE97MSHnwsaQSiqViv2A17HZn mTwSN/dTTWqRkoSIGlbtdAGhX9LV9zIxvLOCCUxTYHvRXCwDqi6oRYU0pS1LBPyKhp91 wfDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=actTZaSA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k188si10811300oib.201.2019.12.16.10.18.56; Mon, 16 Dec 2019 10:18:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=actTZaSA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731869AbfLPSSz (ORCPT + 27 others); Mon, 16 Dec 2019 13:18:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:45472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731858AbfLPSSx (ORCPT ); Mon, 16 Dec 2019 13:18:53 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CE427207FF; Mon, 16 Dec 2019 18:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576520332; bh=wwlmxGK47+3NKt/tCyF1WitVXEn7YD87pa8sUS9EE8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=actTZaSAtAlkWvsRA8QMeGxhX3/mtNZybOInMhK/8cs2ZndyYb2yXFz31+Londt/n xRf8CO7qIiE832uiHTI9FOTzSXcQLGBL0PQiuVimDTjsF/lHgtYyNpGqvm0+++p2wA 29+LJQHRSeZ2XVNy0pfuXhPlCO0I/LJtu9B0c0mk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Yan , Jiri Olsa , Alexander Shishkin , Mark Rutland , Namhyung Kim , Naresh Kamboju , Peter Zijlstra , Wang Nan , Arnaldo Carvalho de Melo Subject: [PATCH 5.4 111/177] perf tests: Fix out of bounds memory access Date: Mon, 16 Dec 2019 18:49:27 +0100 Message-Id: <20191216174842.136673983@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191216174811.158424118@linuxfoundation.org> References: <20191216174811.158424118@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan commit af8490eb2b33684e26a0a927a9d93ae43cd08890 upstream. The test case 'Read backward ring buffer' failed on 32-bit architectures which were found by LKFT perf testing. The test failed on arm32 x15 device, qemu_arm32, qemu_i386, and found intermittent failure on i386; the failure log is as below: 50: Read backward ring buffer : --- start --- test child forked, pid 510 Using CPUID GenuineIntel-6-9E-9 mmap size 1052672B mmap size 8192B Finished reading overwrite ring buffer: rewind free(): invalid next size (fast) test child interrupted ---- end ---- Read backward ring buffer: FAILED! The log hints there have issue for memory usage, thus free() reports error 'invalid next size' and directly exit for the case. Finally, this issue is root caused as out of bounds memory access for the data array 'evsel->id'. The backward ring buffer test invokes do_test() twice. 'evsel->id' is allocated at the first call with the flow: test__backward_ring_buffer() `-> do_test() `-> evlist__mmap() `-> evlist__mmap_ex() `-> perf_evsel__alloc_id() So 'evsel->id' is allocated with one item, and it will be used in function perf_evlist__id_add(): evsel->id[0] = id evsel->ids = 1 At the second call for do_test(), it skips to initialize 'evsel->id' and reuses the array which is allocated in the first call. But 'evsel->ids' contains the stale value. Thus: evsel->id[1] = id -> out of bound access evsel->ids = 2 To fix this issue, we will use evlist__open() and evlist__close() pair functions to prepare and cleanup context for evlist; so 'evsel->id' and 'evsel->ids' can be initialized properly when invoke do_test() and avoid the out of bounds memory access. Fixes: ee74701ed8ad ("perf tests: Add test to check backward ring buffer") Signed-off-by: Leo Yan Reviewed-by: Jiri Olsa Cc: Alexander Shishkin Cc: Mark Rutland Cc: Namhyung Kim Cc: Naresh Kamboju Cc: Peter Zijlstra Cc: Wang Nan Cc: stable@vger.kernel.org # v4.10+ Link: http://lore.kernel.org/lkml/20191107020244.2427-1-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/tests/backward-ring-buffer.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/tools/perf/tests/backward-ring-buffer.c +++ b/tools/perf/tests/backward-ring-buffer.c @@ -147,6 +147,15 @@ int test__backward_ring_buffer(struct te goto out_delete_evlist; } + evlist__close(evlist); + + err = evlist__open(evlist); + if (err < 0) { + pr_debug("perf_evlist__open: %s\n", + str_error_r(errno, sbuf, sizeof(sbuf))); + goto out_delete_evlist; + } + err = do_test(evlist, 1, &sample_count, &comm_count); if (err != TEST_OK) goto out_delete_evlist; From patchwork Mon Dec 16 17:49:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181785 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4673437ile; Mon, 16 Dec 2019 10:23:37 -0800 (PST) X-Google-Smtp-Source: APXvYqydaiDo7a60RJfmS3vej0UL4XJGtknx/iyee0eIaeaxmayf8CTHUZAbQP1NlpMScaVSknoM X-Received: by 2002:a9d:175:: with SMTP id 108mr32768147otu.325.1576520615283; Mon, 16 Dec 2019 10:23:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576520615; cv=none; d=google.com; s=arc-20160816; b=DiUJqiROSaGKL+dPjo0n5rsO+E/Z4c42bLIMpscnrTtjv6zc89vimBONrXphgsqHJd MJHw+G24mJkB/VYEtiHQdVZJbpdBEtLrtFZkVdOED+2OehhnnqizIAVfxtUDjlom6J55 a/wf2YzweqdbYtcoLHx5+yZQWPKg1Hl5GsVyMax2eIRoVGa7bj0On89gcuW1axfiWpWv bwoIRuXUdPRQqx+3Ir6DCHSLGo/84SFqJ7pvQkcAt0u9TJ0ccdQFqKmfD1t7FGQR/BwZ ChbcbSmJrmCZg65c8c2ku3UiOIIdkyUFDDZRVATGoF2LI/+Uu4AKIY0tC403ueJoIBcq aeTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6gzpBaurV2pbGYeo4dbaffg7HecLjR3Mkpt2ajvxTsQ=; b=f/W4nXaIwUl0A4B+1guOr4Z98atUIb0qTxzzsVh9JD/+EFhIrNWfM5t3YzUHxI+M8u e6uro+AeRiNyBsbQml9q61zt75p2IOcSegdN3s18bp/YpSiTHVygsVx7cdRaiRyZ4rCb QLtwqGB2XF09GQw9ibRO2ZNWGpBKaMJglA+xhN6wVJh1Rp2IfioQa+swdbLmqIO1DDfz hzTe8CHhNK7yDYCtBP+iPyiJjLt5I1dhVPNXckGn0oAS95gWU/fyC2AKGBCkjC5/jvXd StzrApfqbYjiVOHyN5+XpaOClbqWF/JDAjDHrsX3H6fsf4mLvAGjMYC1wZhqBoh1z4oW ZWWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Mybrmzor; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si10938116otq.51.2019.12.16.10.23.34; Mon, 16 Dec 2019 10:23:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Mybrmzor; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732035AbfLPSUL (ORCPT + 27 others); Mon, 16 Dec 2019 13:20:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:49252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732012AbfLPSUD (ORCPT ); Mon, 16 Dec 2019 13:20:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7158221739; Mon, 16 Dec 2019 18:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576520402; bh=pDM9YgV4ACQyf4D8/DQYrmhcjDCqeiLjgwAC5zEHwIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MybrmzorL1vVGDsDwQ3Un/sxWHr5cmaFovWq3aDR/lt3IuiL1fRx/4qOANhAuM/pJ wsb9iSyq+vsd1S2wg+63xySKT5kQ1i+XB+n5bGFdhG77ijacH5jodfJyrGLqCmwvic mDhwnL44h/GFGfRpFWl0sI/Fx+CNNlbdZ4OOwX1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann Subject: [PATCH 5.4 141/177] ppdev: fix PPGETTIME/PPSETTIME ioctls Date: Mon, 16 Dec 2019 18:49:57 +0100 Message-Id: <20191216174846.834159741@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191216174811.158424118@linuxfoundation.org> References: <20191216174811.158424118@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann commit 998174042da229e2cf5841f574aba4a743e69650 upstream. Going through the uses of timeval in the user space API, I noticed two bugs in ppdev that were introduced in the y2038 conversion: * The range check was accidentally moved from ppsettime to ppgettime * On sparc64, the microseconds are in the other half of the 64-bit word. Fix both, and mark the fix for stable backports. Cc: stable@vger.kernel.org Fixes: 3b9ab374a1e6 ("ppdev: convert to y2038 safe") Signed-off-by: Arnd Bergmann Link: https://lore.kernel.org/r/20191108203435.112759-8-arnd@arndb.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/char/ppdev.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -619,20 +619,27 @@ static int pp_do_ioctl(struct file *file if (copy_from_user(time32, argp, sizeof(time32))) return -EFAULT; + if ((time32[0] < 0) || (time32[1] < 0)) + return -EINVAL; + return pp_set_timeout(pp->pdev, time32[0], time32[1]); case PPSETTIME64: if (copy_from_user(time64, argp, sizeof(time64))) return -EFAULT; + if ((time64[0] < 0) || (time64[1] < 0)) + return -EINVAL; + + if (IS_ENABLED(CONFIG_SPARC64) && !in_compat_syscall()) + time64[1] >>= 32; + return pp_set_timeout(pp->pdev, time64[0], time64[1]); case PPGETTIME32: jiffies_to_timespec64(pp->pdev->timeout, &ts); time32[0] = ts.tv_sec; time32[1] = ts.tv_nsec / NSEC_PER_USEC; - if ((time32[0] < 0) || (time32[1] < 0)) - return -EINVAL; if (copy_to_user(argp, time32, sizeof(time32))) return -EFAULT; @@ -643,8 +650,9 @@ static int pp_do_ioctl(struct file *file jiffies_to_timespec64(pp->pdev->timeout, &ts); time64[0] = ts.tv_sec; time64[1] = ts.tv_nsec / NSEC_PER_USEC; - if ((time64[0] < 0) || (time64[1] < 0)) - return -EINVAL; + + if (IS_ENABLED(CONFIG_SPARC64) && !in_compat_syscall()) + time64[1] <<= 32; if (copy_to_user(argp, time64, sizeof(time64))) return -EFAULT;