From: Rob Clark Subject: [PATCH] drm: drm_ioctl() should zero-init extra data Date: Sun, 18 Sep 2011 14:38:15 -0500 Message-ID: <1316374695-6638-1-git-send-email-rob.clark@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-yw0-f49.google.com (mail-yw0-f49.google.com [209.85.213.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 9CE6D9E808 for ; Sun, 18 Sep 2011 12:38:15 -0700 (PDT) Received: by ywf9 with SMTP id 9so4255718ywf.36 for ; Sun, 18 Sep 2011 12:38:15 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org Cc: Rob Clark , patches@linaro.org List-Id: dri-devel@lists.freedesktop.org From: Rob Clark If an older userspace passes in a smaller arg than the current kernel ioctl arg struct, then extra fields should be initialized to zero rather than passing random data to the DRM driver. Signed-off-by: Rob Clark --- A potential issue that Daniel Vetter spotted. It isn't currently an issue, but I thought it would be better to fix now than forget about it and have problems later. drivers/gpu/drm/drm_drv.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 93a112d..7a87e08 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -438,6 +438,8 @@ long drm_ioctl(struct file *filp, goto err_i1; } } + if (asize > usize) + memset(kdata + usize, 0, asize - usize); } if (cmd & IOC_IN) { -- 1.7.5.4