linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] telephony: fix return value
@ 2010-10-26 17:53 Nicolas Kaiser
  2010-10-29  9:42 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Kaiser @ 2010-10-26 17:53 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-kernel

If copy_from_user fails, the return value gets overwritten.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
 drivers/telephony/ixj.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index 0d236f4..2d1280a 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -6581,7 +6581,8 @@ static long do_ixj_ioctl(struct file *file_p, unsigned int cmd, unsigned long ar
 	case IXJCTL_SET_FILTER:
 		if (copy_from_user(&jf, argp, sizeof(jf))) 
 			retval = -EFAULT;
-		retval = ixj_init_filter(j, &jf);
+		else
+			retval = ixj_init_filter(j, &jf);
 		break;
 	case IXJCTL_SET_FILTER_RAW:
 		if (copy_from_user(&jfr, argp, sizeof(jfr))) 
-- 
1.7.2.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] telephony: fix return value
  2010-10-26 17:53 [PATCH] telephony: fix return value Nicolas Kaiser
@ 2010-10-29  9:42 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2010-10-29  9:42 UTC (permalink / raw)
  To: Nicolas Kaiser; +Cc: linux-kernel

On Tue, 26 Oct 2010, Nicolas Kaiser wrote:

> If copy_from_user fails, the return value gets overwritten.
> 
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
> ---
>  drivers/telephony/ixj.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
> index 0d236f4..2d1280a 100644
> --- a/drivers/telephony/ixj.c
> +++ b/drivers/telephony/ixj.c
> @@ -6581,7 +6581,8 @@ static long do_ixj_ioctl(struct file *file_p, unsigned int cmd, unsigned long ar
>  	case IXJCTL_SET_FILTER:
>  		if (copy_from_user(&jf, argp, sizeof(jf))) 
>  			retval = -EFAULT;
> -		retval = ixj_init_filter(j, &jf);
> +		else
> +			retval = ixj_init_filter(j, &jf);
>  		break;
>  	case IXJCTL_SET_FILTER_RAW:
>  		if (copy_from_user(&jfr, argp, sizeof(jfr))) 

Applied, thanks Nicolas.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-29  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-26 17:53 [PATCH] telephony: fix return value Nicolas Kaiser
2010-10-29  9:42 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).