From patchwork Tue Dec 21 01:18:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Farina X-Patchwork-Id: 423121 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBL1Iw5r006163 for ; Tue, 21 Dec 2010 01:18:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933220Ab0LUBSa (ORCPT ); Mon, 20 Dec 2010 20:18:30 -0500 Received: from mail-gy0-f174.google.com ([209.85.160.174]:64858 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932864Ab0LUBS3 (ORCPT ); Mon, 20 Dec 2010 20:18:29 -0500 Received: by gyb11 with SMTP id 11so1458883gyb.19 for ; Mon, 20 Dec 2010 17:18:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:mime-version:content-type :content-transfer-encoding; bh=KxT9QHiJW7sEzP2H2wZ8ol1pw0l8F4mBRIVe13Kab/4=; b=bXv5XViZ5za8rTRydtWTcKiS9fFnYN/rBhWSE6RsINjDHqkkdXlspkXMW0/eE/tWhn 8T0kv39uotguaFdatrxgTFzJz0Vg1tW/IlPxgYWUB1Lid37lPErwDo19+NjUcuvUbyc5 jLBwpruCX+O7qDZ1Op48gJ5nQgQoGc72aMzzo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; b=dJZPOihxbdqm5SQy8cm8L4DeiC024xc6upGiGtK2/WXunhbZSMid6u2ZEC9kQzxUfb OrNdACOa3gzNpkqBM+c6HGJ5/dQrjrrP4fLFf+jwyJfR8NYcGSpZig2nm19pgVzsaPYB bjTu2yg7e5Cd1tXYAc5LKbUcsNaq11LfGZ564= Received: by 10.150.218.16 with SMTP id q16mr7432488ybg.404.1292894308832; Mon, 20 Dec 2010 17:18:28 -0800 (PST) Received: from localhost ([186.205.6.151]) by mx.google.com with ESMTPS id r24sm7816693yba.6.2010.12.20.17.18.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 20 Dec 2010 17:18:27 -0800 (PST) From: Thiago Farina To: linux-kernel@vger.kernel.org Cc: Thiago Farina , Guennadi Liakhovetski , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH] drivers/media/video/v4l2-compat-ioctl32.c: Check the return value of copy_to_user Date: Mon, 20 Dec 2010 23:18:06 -0200 Message-Id: X-Mailer: git-send-email 1.7.3.2.343.g7d43d MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 21 Dec 2010 01:19:27 +0000 (UTC) diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index e30e8df..55825ec 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -206,7 +206,9 @@ static struct video_code __user *get_microcode32(struct video_code32 *kp) * user address is invalid, the native ioctl will do * the error handling for us */ - (void) copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat)); + if (copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat))) + return NULL; + (void) put_user(kp->datasize, &up->datasize); (void) put_user(compat_ptr(kp->data), &up->data); return up;