From patchwork Fri Jun 4 10:36:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 104252 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o54AamXx031519 for ; Fri, 4 Jun 2010 10:36:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753866Ab0FDKgq (ORCPT ); Fri, 4 Jun 2010 06:36:46 -0400 Received: from mail-ew0-f223.google.com ([209.85.219.223]:48644 "EHLO mail-ew0-f223.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922Ab0FDKgp (ORCPT ); Fri, 4 Jun 2010 06:36:45 -0400 Received: by ewy23 with SMTP id 23so263666ewy.1 for ; Fri, 04 Jun 2010 03:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=YrTpsr1VLvYLBY4++TE1p4frZpBXf3mzgM1raQ2gLFc=; b=G0Cd5PC7V7PGnbxa4DSVKtNV2ewEHXPA2cv6Q0XJ/ydZ7Cn8Mwm6HzUBPxoDzSyfIQ utXBL0KRKcTRywP1kbb1XYiI4EN6/ZufMCOdZX5OedMQWdhUa7BK453v4m75xJvJFyDJ mRiHsPXqWE95panijwbuC6G+EVBpCRCUdn7y4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=bEaMPVFPzqaYbTMO1+dDWRqDDgMUhqEGVcvhQi1Wd03GHJyQNV0Ehs2dl3xAIczr0r JZF7Y9NrO13AcQ93cSKXp8gMxNWCEwXPoXE/08wgjg5NBILa7Nsj0t9x82IFtlTAN1wU /i613Htvkk1ZWp/vYX+iEw8SyZEwPTC6Wgpfc= Received: by 10.213.3.83 with SMTP id 19mr7735130ebm.79.1275647803365; Fri, 04 Jun 2010 03:36:43 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id 13sm634476ewy.9.2010.06.04.03.36.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 04 Jun 2010 03:36:42 -0700 (PDT) Date: Fri, 4 Jun 2010 12:36:29 +0200 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Frederic Weisbecker , Arnd Bergmann , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] V4L/DVB: dvb_ca_en50221: return -EFAULT on copy_to_user errors Message-ID: <20100604103629.GC5483@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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 (demeter.kernel.org [140.211.167.41]); Fri, 04 Jun 2010 10:36:49 +0000 (UTC) diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index ef259a0..aa7a298 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -1318,8 +1318,10 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file, fragbuf[0] = connection_id; fragbuf[1] = ((fragpos + fraglen) < count) ? 0x80 : 0x00; - if ((status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen)) != 0) + if ((status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen)) != 0) { + status = -EFAULT; goto exit; + } timeout = jiffies + HZ / 2; written = 0; @@ -1494,8 +1496,10 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf, hdr[0] = slot; hdr[1] = connection_id; - if ((status = copy_to_user(buf, hdr, 2)) != 0) + if ((status = copy_to_user(buf, hdr, 2)) != 0) { + status = -EFAULT; goto exit; + } status = pktlen; exit: