mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] raw1394 missing failure handling
@ 2005-03-02 11:10 Panagiotis Issaris
  2005-03-02 11:33 ` Anton Altaparmakov
  2005-03-02 11:37 ` Sergey Vlasov
  0 siblings, 2 replies; 11+ messages in thread
From: Panagiotis Issaris @ 2005-03-02 11:10 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

Hi,

In the raw1394 driver the failure handling for
a __copy_to_user call is missing.

With friendly regards,
Takis

-- 
  K.U.Leuven, Mechanical Eng.,  Mechatronics & Robotics Research Group
  http://people.mech.kuleuven.ac.be/~pissaris/


[-- Attachment #2: pi-20050302T114855-linux_2_6_11-raw1394_copy_to_user_failure_handling.diff --]
[-- Type: text/x-patch, Size: 661 bytes --]

diff -pruN linux-2.6.11/drivers/ieee1394/raw1394.c linux-2.6.11-pi/drivers/ieee1394/raw1394.c
--- linux-2.6.11/drivers/ieee1394/raw1394.c	2005-03-02 11:44:26.000000000 +0100
+++ linux-2.6.11-pi/drivers/ieee1394/raw1394.c	2005-03-02 11:47:38.000000000 +0100
@@ -443,7 +443,8 @@ static ssize_t raw1394_read(struct file 
                         req->req.error = RAW1394_ERROR_MEMFAULT;
                 }
         }
-        __copy_to_user(buffer, &req->req, sizeof(req->req));
+        if (__copy_to_user(buffer, &req->req, sizeof(req->req)))
+                return -EFAULT;
 
         free_pending_request(req);
         return sizeof(struct raw1394_request);

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

* Re: [PATCH] raw1394 missing failure handling
  2005-03-02 11:10 [PATCH] raw1394 missing failure handling Panagiotis Issaris
@ 2005-03-02 11:33 ` Anton Altaparmakov
  2005-03-02 12:28   ` Panagiotis Issaris
  2005-03-02 11:37 ` Sergey Vlasov
  1 sibling, 1 reply; 11+ messages in thread
From: Anton Altaparmakov @ 2005-03-02 11:33 UTC (permalink / raw)
  To: Panagiotis Issaris; +Cc: lkml

Hi,

On Wed, 2005-03-02 at 12:10 +0100, Panagiotis Issaris wrote:
> In the raw1394 driver the failure handling for
> a __copy_to_user call is missing.

Your patch is obviously incorrect as it doesn't free the request before
it returns.

Best regards,

        Anton
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/


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

* Re: [PATCH] raw1394 missing failure handling
  2005-03-02 11:10 [PATCH] raw1394 missing failure handling Panagiotis Issaris
  2005-03-02 11:33 ` Anton Altaparmakov
@ 2005-03-02 11:37 ` Sergey Vlasov
  1 sibling, 0 replies; 11+ messages in thread
From: Sergey Vlasov @ 2005-03-02 11:37 UTC (permalink / raw)
  To: Panagiotis Issaris; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1165 bytes --]

On Wed, 02 Mar 2005 12:10:50 +0100 Panagiotis Issaris wrote:

> In the raw1394 driver the failure handling for
> a __copy_to_user call is missing.
> 
> With friendly regards,
> Takis
> 
> -- 
>   K.U.Leuven, Mechanical Eng.,  Mechatronics & Robotics Research Group
>   http://people.mech.kuleuven.ac.be/~pissaris/
> 
> 
> 
> [pi-20050302T114855-linux_2_6_11-raw1394_copy_to_user_failure_handling.diff  text/x-patch (922 bytes)]
> diff -pruN linux-2.6.11/drivers/ieee1394/raw1394.c linux-2.6.11-pi/drivers/ieee1394/raw1394.c
> --- linux-2.6.11/drivers/ieee1394/raw1394.c	2005-03-02 11:44:26.000000000 +0100
> +++ linux-2.6.11-pi/drivers/ieee1394/raw1394.c	2005-03-02 11:47:38.000000000 +0100
> @@ -443,7 +443,8 @@ static ssize_t raw1394_read(struct file 
>                          req->req.error = RAW1394_ERROR_MEMFAULT;
>                  }
>          }
> -        __copy_to_user(buffer, &req->req, sizeof(req->req));
> +        if (__copy_to_user(buffer, &req->req, sizeof(req->req)))
> +                return -EFAULT;

Bug: "req" is not freed in the failure case.

>  
>          free_pending_request(req);
>          return sizeof(struct raw1394_request);
> 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] raw1394 missing failure handling
  2005-03-02 11:33 ` Anton Altaparmakov
@ 2005-03-02 12:28   ` Panagiotis Issaris
  2005-03-02 14:24     ` Dmitry Torokhov
  0 siblings, 1 reply; 11+ messages in thread
From: Panagiotis Issaris @ 2005-03-02 12:28 UTC (permalink / raw)
  To: Anton Altaparmakov; +Cc: lkml

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

Hi,

Anton Altaparmakov wrote:

>On Wed, 2005-03-02 at 12:10 +0100, Panagiotis Issaris wrote:
>  
>
>>In the raw1394 driver the failure handling for
>>a __copy_to_user call is missing.
>>    
>>
>
>Your patch is obviously incorrect as it doesn't free the request before
>it returns.
>  
>
Oops. Thanks for replying! Any more problems with the updated
patch?

With friendly regards,
Takis

-- 
  K.U.Leuven, Mechanical Eng.,  Mechatronics & Robotics Research Group
  http://people.mech.kuleuven.ac.be/~pissaris/


[-- Attachment #2: pi-20050302T131628-linux_2_6_11-1394_copy_to_user_failure_handling.diff --]
[-- Type: text/x-patch, Size: 728 bytes --]

diff -pruN linux-2.6.11/drivers/ieee1394/raw1394.c linux-2.6.11-pi/drivers/ieee1394/raw1394.c
--- linux-2.6.11/drivers/ieee1394/raw1394.c	2005-03-02 11:44:26.000000000 +0100
+++ linux-2.6.11-pi/drivers/ieee1394/raw1394.c	2005-03-02 13:15:58.000000000 +0100
@@ -443,7 +443,11 @@ static ssize_t raw1394_read(struct file 
                         req->req.error = RAW1394_ERROR_MEMFAULT;
                 }
         }
-        __copy_to_user(buffer, &req->req, sizeof(req->req));
+        if (__copy_to_user(buffer, &req->req, sizeof(req->req)))
+        {
+                free_pending_request(req);
+                return -EFAULT;
+        }
 
         free_pending_request(req);
         return sizeof(struct raw1394_request);

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

* Re: [PATCH] raw1394 missing failure handling
  2005-03-02 12:28   ` Panagiotis Issaris
@ 2005-03-02 14:24     ` Dmitry Torokhov
  2005-03-02 14:30       ` Panagiotis Issaris
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Torokhov @ 2005-03-02 14:24 UTC (permalink / raw)
  To: Panagiotis Issaris; +Cc: Anton Altaparmakov, lkml

On Wed, 02 Mar 2005 13:28:23 +0100, Panagiotis Issaris
<panagiotis.issaris@mech.kuleuven.ac.be> wrote:
> Hi,
> 
> Anton Altaparmakov wrote:
> 
> >On Wed, 2005-03-02 at 12:10 +0100, Panagiotis Issaris wrote:
> >
> >
> >>In the raw1394 driver the failure handling for
> >>a __copy_to_user call is missing.
> >>
> >>
> >
> >Your patch is obviously incorrect as it doesn't free the request before
> >it returns.
> >
> >
> Oops. Thanks for replying! Any more problems with the updated
> patch?
> 

Formatting... Opening curly brace should go on the same line with "if".

-- 
Dmitry

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

* Re: [PATCH] raw1394 missing failure handling
  2005-03-02 14:24     ` Dmitry Torokhov
@ 2005-03-02 14:30       ` Panagiotis Issaris
  2005-03-03 21:48         ` Jody McIntyre
  0 siblings, 1 reply; 11+ messages in thread
From: Panagiotis Issaris @ 2005-03-02 14:30 UTC (permalink / raw)
  To: dtor_core; +Cc: Anton Altaparmakov, lkml

[-- Attachment #1: Type: text/plain, Size: 488 bytes --]

Hi,

Dmitry Torokhov wrote:

>On Wed, 02 Mar 2005 13:28:23 +0100, Panagiotis Issaris
><panagiotis.issaris@mech.kuleuven.ac.be> wrote:
>  
>
>>Oops. Thanks for replying! Any more problems with the updated
>>patch?
>>    
>>
>Formatting... Opening curly brace should go on the same line with "if".
>  
>
Thanks. Here's my third try :-)

With friendly regards,
Takis

-- 
  K.U.Leuven, Mechanical Eng.,  Mechatronics & Robotics Research Group
  http://people.mech.kuleuven.ac.be/~pissaris/


[-- Attachment #2: pi-20050302T152730-linux_2_6_11-1394_copy_to_user_failure_handling_3.diff --]
[-- Type: text/x-patch, Size: 719 bytes --]

diff -pruN linux-2.6.11/drivers/ieee1394/raw1394.c linux-2.6.11-pi/drivers/ieee1394/raw1394.c
--- linux-2.6.11/drivers/ieee1394/raw1394.c	2005-03-02 11:44:26.000000000 +0100
+++ linux-2.6.11-pi/drivers/ieee1394/raw1394.c	2005-03-02 15:27:15.000000000 +0100
@@ -443,7 +443,10 @@ static ssize_t raw1394_read(struct file 
                         req->req.error = RAW1394_ERROR_MEMFAULT;
                 }
         }
-        __copy_to_user(buffer, &req->req, sizeof(req->req));
+        if (__copy_to_user(buffer, &req->req, sizeof(req->req))) {
+                free_pending_request(req);
+                return -EFAULT;
+        }
 
         free_pending_request(req);
         return sizeof(struct raw1394_request);

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

* Re: [PATCH] raw1394 missing failure handling
  2005-03-02 14:30       ` Panagiotis Issaris
@ 2005-03-03 21:48         ` Jody McIntyre
  2005-03-03 22:41           ` Panagiotis Issaris
  2005-03-03 22:55           ` Panagiotis Issaris
  0 siblings, 2 replies; 11+ messages in thread
From: Jody McIntyre @ 2005-03-03 21:48 UTC (permalink / raw)
  To: Panagiotis Issaris; +Cc: dtor_core, Anton Altaparmakov, lkml, linux1394-devel

> Thanks. Here's my third try :-)
> 
> With friendly regards,
> Takis

I'll apply this to the 1394 tree and send it to Linus after testing if
you add a Signed-off-by: line per Documentation/SubmittingPatches .
Also, please cc linux1394-devel@lists.sourceforge.net with ieee1394
changes.

Thanks,
Jody

> 
> -- 
>  K.U.Leuven, Mechanical Eng.,  Mechatronics & Robotics Research Group
>  http://people.mech.kuleuven.ac.be/~pissaris/
> 

> diff -pruN linux-2.6.11/drivers/ieee1394/raw1394.c linux-2.6.11-pi/drivers/ieee1394/raw1394.c
> --- linux-2.6.11/drivers/ieee1394/raw1394.c	2005-03-02 11:44:26.000000000 +0100
> +++ linux-2.6.11-pi/drivers/ieee1394/raw1394.c	2005-03-02 15:27:15.000000000 +0100
> @@ -443,7 +443,10 @@ static ssize_t raw1394_read(struct file 
>                          req->req.error = RAW1394_ERROR_MEMFAULT;
>                  }
>          }
> -        __copy_to_user(buffer, &req->req, sizeof(req->req));
> +        if (__copy_to_user(buffer, &req->req, sizeof(req->req))) {
> +                free_pending_request(req);
> +                return -EFAULT;
> +        }
>  
>          free_pending_request(req);
>          return sizeof(struct raw1394_request);


-- 

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

* Re: [PATCH] raw1394 missing failure handling
  2005-03-03 21:48         ` Jody McIntyre
@ 2005-03-03 22:41           ` Panagiotis Issaris
  2005-03-03 22:55           ` Panagiotis Issaris
  1 sibling, 0 replies; 11+ messages in thread
From: Panagiotis Issaris @ 2005-03-03 22:41 UTC (permalink / raw)
  To: Jody McIntyre; +Cc: dtor_core, Anton Altaparmakov, lkml, linux1394-devel

Hi,

Jody McIntyre wrote:

>I'll apply this to the 1394 tree and send it to Linus after testing if
>you add a Signed-off-by: line per Documentation/SubmittingPatches .
>Also, please cc linux1394-devel@lists.sourceforge.net with ieee1394
>changes.
>
Sure! Thanks!


Adds the missing failure handling for a __copy_to_user call.


Signed-off-by: Panagiotis Issaris <takis@gna.org>

diff -pruN linux-2.6.11/drivers/ieee1394/raw1394.c linux-2.6.11-pi/drivers/ieee1394/raw1394.c
--- linux-2.6.11/drivers/ieee1394/raw1394.c	2005-03-02 11:44:26.000000000 +0100
+++ linux-2.6.11-pi/drivers/ieee1394/raw1394.c	2005-03-02 15:27:15.000000000 +0100
@@ -443,7 +443,10 @@ static ssize_t raw1394_read(struct file 
                         req->req.error = RAW1394_ERROR_MEMFAULT;
                 }
         }
-        __copy_to_user(buffer, &req->req, sizeof(req->req));
+        if (__copy_to_user(buffer, &req->req, sizeof(req->req))) {
+                free_pending_request(req);
+                return -EFAULT;
+        }
 
         free_pending_request(req);
         return sizeof(struct raw1394_request);



-- 
  K.U.Leuven, Mechanical Eng.,  Mechatronics & Robotics Research Group
  http://people.mech.kuleuven.ac.be/~pissaris/


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

* Re: [PATCH] raw1394 missing failure handling
  2005-03-03 21:48         ` Jody McIntyre
  2005-03-03 22:41           ` Panagiotis Issaris
@ 2005-03-03 22:55           ` Panagiotis Issaris
  2005-03-05 18:47             ` Jody McIntyre
  1 sibling, 1 reply; 11+ messages in thread
From: Panagiotis Issaris @ 2005-03-03 22:55 UTC (permalink / raw)
  To: Jody McIntyre; +Cc: dtor_core, Anton Altaparmakov, lkml, linux1394-devel

Hi Jody,

My previous e-mail seemed to be messed up by Thunderbird... so now I'm using good
old Mutt again.

On Thu, Mar 03, 2005 at 04:48:43PM -0500 or thereabouts, Jody McIntyre wrote:
> > Thanks. Here's my third try :-)
> > 
> > With friendly regards,
> > Takis
> 
> I'll apply this to the 1394 tree and send it to Linus after testing if
> you add a Signed-off-by: line per Documentation/SubmittingPatches .
> Also, please cc linux1394-devel@lists.sourceforge.net with ieee1394
> changes.

Sure! Thanks!


Adds the missing failure handling for a __copy_to_user call.


Signed-off-by: Panagiotis Issaris <takis@gna.org>


diff -pruN linux-2.6.11/drivers/ieee1394/raw1394.c linux-2.6.11-pi/drivers/ieee1394/raw1394.c
--- linux-2.6.11/drivers/ieee1394/raw1394.c	2005-03-02 11:44:26.000000000 +0100
+++ linux-2.6.11-pi/drivers/ieee1394/raw1394.c	2005-03-02 15:27:15.000000000 +0100
@@ -443,7 +443,10 @@ static ssize_t raw1394_read(struct file 
                         req->req.error = RAW1394_ERROR_MEMFAULT;
                 }
         }
-        __copy_to_user(buffer, &req->req, sizeof(req->req));
+        if (__copy_to_user(buffer, &req->req, sizeof(req->req))) {
+                free_pending_request(req);
+                return -EFAULT;
+        }
 
         free_pending_request(req);
         return sizeof(struct raw1394_request);


-- 
  K.U.Leuven, Mechanical Eng.,  Mechatronics & Robotics Research Group
  http://people.mech.kuleuven.ac.be/~pissaris/


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

* Re: [PATCH] raw1394 missing failure handling
  2005-03-03 22:55           ` Panagiotis Issaris
@ 2005-03-05 18:47             ` Jody McIntyre
  2005-03-05 21:10               ` Gene Heskett
  0 siblings, 1 reply; 11+ messages in thread
From: Jody McIntyre @ 2005-03-05 18:47 UTC (permalink / raw)
  To: Panagiotis Issaris; +Cc: dtor_core, Anton Altaparmakov, lkml, linux1394-devel

On Thu, Mar 03, 2005 at 11:55:09PM +0100, Panagiotis Issaris wrote:

> Adds the missing failure handling for a __copy_to_user call.
> 
> 
> Signed-off-by: Panagiotis Issaris <takis@gna.org>

Sorry I didn't notice this sooner, but this was already fixed and has
been sent to Linus (hopefully to appear in 2.6.12.)

Jody

> 
> diff -pruN linux-2.6.11/drivers/ieee1394/raw1394.c linux-2.6.11-pi/drivers/ieee1394/raw1394.c
> --- linux-2.6.11/drivers/ieee1394/raw1394.c	2005-03-02 11:44:26.000000000 +0100
> +++ linux-2.6.11-pi/drivers/ieee1394/raw1394.c	2005-03-02 15:27:15.000000000 +0100
> @@ -443,7 +443,10 @@ static ssize_t raw1394_read(struct file 
>                          req->req.error = RAW1394_ERROR_MEMFAULT;
>                  }
>          }
> -        __copy_to_user(buffer, &req->req, sizeof(req->req));
> +        if (__copy_to_user(buffer, &req->req, sizeof(req->req))) {
> +                free_pending_request(req);
> +                return -EFAULT;
> +        }
>  
>          free_pending_request(req);
>          return sizeof(struct raw1394_request);
> 
> 
> -- 
>   K.U.Leuven, Mechanical Eng.,  Mechatronics & Robotics Research Group
>   http://people.mech.kuleuven.ac.be/~pissaris/
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 

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

* Re: [PATCH] raw1394 missing failure handling
  2005-03-05 18:47             ` Jody McIntyre
@ 2005-03-05 21:10               ` Gene Heskett
  0 siblings, 0 replies; 11+ messages in thread
From: Gene Heskett @ 2005-03-05 21:10 UTC (permalink / raw)
  To: linux-kernel

On Saturday 05 March 2005 13:47, Jody McIntyre wrote:
>On Thu, Mar 03, 2005 at 11:55:09PM +0100, Panagiotis Issaris wrote:
>> Adds the missing failure handling for a __copy_to_user call.
>>
>>
>> Signed-off-by: Panagiotis Issaris <takis@gna.org>
>
>Sorry I didn't notice this sooner, but this was already fixed and
> has been sent to Linus (hopefully to appear in 2.6.12.)
>
>Jody

Jody, Panagiotis;  A much more complete patch is already sitting in 
the bk queue.  This is a relatively small piece of that one.  You can 
get it from:

<ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.11/2.6.11-mm1/broken-out>

As the bk-ieee1394.patch you can see there.

>> diff -pruN linux-2.6.11/drivers/ieee1394/raw1394.c
>> linux-2.6.11-pi/drivers/ieee1394/raw1394.c ---
>> linux-2.6.11/drivers/ieee1394/raw1394.c 2005-03-02
>> 11:44:26.000000000 +0100 +++
>> linux-2.6.11-pi/drivers/ieee1394/raw1394.c 2005-03-02
>> 15:27:15.000000000 +0100 @@ -443,7 +443,10 @@ static ssize_t
>> raw1394_read(struct file req->req.error = RAW1394_ERROR_MEMFAULT;
>> }
>>          }
>> -        __copy_to_user(buffer, &req->req, sizeof(req->req));
>> +        if (__copy_to_user(buffer, &req->req, sizeof(req->req)))
>> { +                free_pending_request(req);
>> +                return -EFAULT;
>> +        }
>>
>>          free_pending_request(req);
>>          return sizeof(struct raw1394_request);
>>
>>
>> --
>>   K.U.Leuven, Mechanical Eng.,  Mechatronics & Robotics Research
>> Group http://people.mech.kuleuven.ac.be/~pissaris/
>>
>> -
>> To unsubscribe from this list: send the line "unsubscribe
>> linux-kernel" in the body of a message to
>> majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.34% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attorneys please note, additions to this message
by Gene Heskett are:
Copyright 2005 by Maurice Eugene Heskett, all rights reserved.

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

end of thread, other threads:[~2005-03-05 21:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-02 11:10 [PATCH] raw1394 missing failure handling Panagiotis Issaris
2005-03-02 11:33 ` Anton Altaparmakov
2005-03-02 12:28   ` Panagiotis Issaris
2005-03-02 14:24     ` Dmitry Torokhov
2005-03-02 14:30       ` Panagiotis Issaris
2005-03-03 21:48         ` Jody McIntyre
2005-03-03 22:41           ` Panagiotis Issaris
2005-03-03 22:55           ` Panagiotis Issaris
2005-03-05 18:47             ` Jody McIntyre
2005-03-05 21:10               ` Gene Heskett
2005-03-02 11:37 ` Sergey Vlasov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome