Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3783862ybi; Mon, 29 Jul 2019 12:33:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy01ITAv2hAZIC+e5CkSZ+FbtOhs5texGFZejK0760v+dJ+gEcuDJ2RUdav98Q7aCtCsuSs X-Received: by 2002:a62:16:: with SMTP id 22mr39556153pfa.151.1564428790337; Mon, 29 Jul 2019 12:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428790; cv=none; d=google.com; s=arc-20160816; b=K7MlVmPiA6qwnnqAeh9lHbQNxFDfSiKWiyt5188BjrPivoPx01In5d8i7SwGtU+weC IsnuFjObNBD1PbP4CtIXin3ncjaTVKYmrDEhdLnTfghrvGOj6WNRyJWcB9e1R1ZTT/CQ l32kCJBIWY+5tyHrML2elC3dHBKj6tXDjJqMxXtu3ZCNYwC9+VXTICYRj+u69hVVuX7/ KK9g7RVA5U3GgcAvc3PPfiE7h5ZruHmLOqzX080UpRKcjeT+l/ICdAuQ0Sz7FiVTC89x /5cpz7cfqJ/mVNFtiSdvu4S4jttEwmFaofxSVGWGycqJMJJ9wF9ELgMQYEPeCRuq+cDU Bn5w== 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=wDCForwO0Qp12EtPVInzOrHZUgPuJ+dXvxAKptMf+LU=; b=qZ50TunNiveWhoC3+EBi0Dc99tiIpk7G6BsMioYY2TWZcYxoJqbQj1H/ykKgNu1HiC Ni5YCTEfKL5NhLVfXJwemNu5g51I+0DjREnUt+eH8V5luGAyWyh5TSUcpdhiLo5lBnzI zWtIokxsDCCwtFRgYKbQ8o3TF9aDptzD8Bfh/a/qvzUHVZUMwabRr8ve0eE+sIZm4TEW srToMJfziXDbv252HOJwkrn+TpE0rMEKpwhzdcdJhai7iOLMY1anmJIhR8P4qJRE2PVW iWsYYwol6hZLcAyDtPO/tjJstSVuU9ukGPL/L11frNdlmBPPTjdTxmz//+SiWrS4Yi8e jjIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YX8edpk7; 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 21si3911530pgk.492.2019.07.29.12.32.55; Mon, 29 Jul 2019 12:33:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YX8edpk7; 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 S2388166AbfG2TYi (ORCPT + 99 others); Mon, 29 Jul 2019 15:24:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:36846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729525AbfG2TYg (ORCPT ); Mon, 29 Jul 2019 15:24:36 -0400 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 39B70217D6; Mon, 29 Jul 2019 19:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428275; bh=yg1hvWRvBLsQ6BTuRLMggs3+Q2JAiZAU0MAvu5x9OSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YX8edpk7kt7ez1305ix7+LFbD3xNZVpFHhg+e5ZLejsISF2hDOyGRq8WwvCb/Yl6Z 4Z2HRKKMw6qTTUr1T2B6j2gLhe2CWod+Ww/agDVpwLo4/h242oW1CbTNRShwBXdO5J KAYrTD0AXW2crCNcx3Jw4cCI2ZjbfqK1m6KrbakA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jungo Lin , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 017/293] media: media_device_enum_links32: clean a reserved field Date: Mon, 29 Jul 2019 21:18:28 +0200 Message-Id: <20190729190821.875100068@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit f49308878d7202e07d8761238e01bd0e5fce2750 ] In v4l2-compliance utility, test MEDIA_IOC_ENUM_ENTITIES will check whether reserved field of media_links_enum filled with zero. However, for 32 bit program, the reserved field is missing copy from kernel space to user space in media_device_enum_links32 function. This patch adds the cleaning a reserved field logic in media_device_enum_links32 function. Signed-off-by: Jungo Lin Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/media-device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 62b2c5d9bdfb..a6d56154fac7 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -470,6 +470,7 @@ static long media_device_enum_links32(struct media_device *mdev, { struct media_links_enum links; compat_uptr_t pads_ptr, links_ptr; + int ret; memset(&links, 0, sizeof(links)); @@ -481,7 +482,13 @@ static long media_device_enum_links32(struct media_device *mdev, links.pads = compat_ptr(pads_ptr); links.links = compat_ptr(links_ptr); - return media_device_enum_links(mdev, &links); + ret = media_device_enum_links(mdev, &links); + if (ret) + return ret; + + memset(ulinks->reserved, 0, sizeof(ulinks->reserved)); + + return 0; } #define MEDIA_IOC_ENUM_LINKS32 _IOWR('|', 0x02, struct media_links_enum32) -- 2.20.1