* [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c
@ 2006-03-16 6:42 Eugene Teo
2006-03-16 7:07 ` Eugene Teo
2006-03-16 11:20 ` [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c Ralf Baechle
0 siblings, 2 replies; 9+ messages in thread
From: Eugene Teo @ 2006-03-16 6:42 UTC (permalink / raw)
To: linux-kernel
Cc: Thomas Osterried DL9SAU, Ralf Baechle DL5RB, Hans Alblas PE1AYX
Pointer ax is dereferenced before NULL check.
Coverity bug #817
Signed-off-by: Eugene Teo <eugene.teo@eugeneteo.net>
--- linux-2.6/drivers/net/hamradio/mkiss.c~ 2006-03-15 10:05:35.000000000 +0800
+++ linux-2.6/drivers/net/hamradio/mkiss.c 2006-03-16 14:31:35.000000000 +0800
@@ -844,13 +844,16 @@ static void mkiss_close(struct tty_struc
static int mkiss_ioctl(struct tty_struct *tty, struct file *file,
unsigned int cmd, unsigned long arg)
{
- struct mkiss *ax = mkiss_get(tty);
- struct net_device *dev = ax->dev;
+ struct mkiss *ax;
+ struct net_device *dev;
unsigned int tmp, err;
/* First make sure we're connected. */
if (ax == NULL)
return -ENXIO;
+
+ ax = mkiss_get(tty);
+ dev = ax->dev;
switch (cmd) {
case SIOCGIFNAME:
--
1024D/A6D12F80 print D51D 2633 8DAC 04DB 7265 9BB8 5883 6DAA A6D1 2F80
main(i) { putchar(182623909 >> (i-1) * 5&31|!!(i<7)<<6) && main(++i); }
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c
2006-03-16 6:42 [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c Eugene Teo
@ 2006-03-16 7:07 ` Eugene Teo
2006-03-16 8:11 ` David S. Miller
` (2 more replies)
2006-03-16 11:20 ` [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c Ralf Baechle
1 sibling, 3 replies; 9+ messages in thread
From: Eugene Teo @ 2006-03-16 7:07 UTC (permalink / raw)
To: linux-kernel
Cc: Thomas Osterried DL9SAU, Ralf Baechle DL5RB, Hans Alblas PE1AYX
<quote sender="Eugene Teo">
> Pointer ax is dereferenced before NULL check.
>
> Coverity bug #817
>
> Signed-off-by: Eugene Teo <eugene.teo@eugeneteo.net>
Ignore the previous patch please. Here's a resend.
--
Pointer ax is dereferenced before NULL check.
Coverity bug #817
Signed-off-by: Eugene Teo <eugene.teo@eugeneteo.net>
--- linux-2.6/drivers/net/hamradio/mkiss.c~ 2006-03-15 10:05:35.000000000 +0800
+++ linux-2.6/drivers/net/hamradio/mkiss.c 2006-03-16 15:06:02.000000000 +0800
@@ -845,13 +845,15 @@ static int mkiss_ioctl(struct tty_struct
unsigned int cmd, unsigned long arg)
{
struct mkiss *ax = mkiss_get(tty);
- struct net_device *dev = ax->dev;
+ struct net_device *dev;
unsigned int tmp, err;
/* First make sure we're connected. */
if (ax == NULL)
return -ENXIO;
+ dev = ax->dev;
+
switch (cmd) {
case SIOCGIFNAME:
err = copy_to_user((void __user *) arg, ax->dev->name,
--
1024D/A6D12F80 print D51D 2633 8DAC 04DB 7265 9BB8 5883 6DAA A6D1 2F80
main(i) { putchar(182623909 >> (i-1) * 5&31|!!(i<7)<<6) && main(++i); }
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c
2006-03-16 7:07 ` Eugene Teo
@ 2006-03-16 8:11 ` David S. Miller
2006-03-16 8:24 ` Alexey Dobriyan
2006-03-16 10:14 ` Raj Kumar Yadav
2 siblings, 0 replies; 9+ messages in thread
From: David S. Miller @ 2006-03-16 8:11 UTC (permalink / raw)
To: eugene.teo; +Cc: linux-kernel, thomas, ralf, hans
From: Eugene Teo <eugene.teo@eugeneteo.net>
Date: Thu, 16 Mar 2006 15:07:37 +0800
> Pointer ax is dereferenced before NULL check.
>
> Coverity bug #817
>
> Signed-off-by: Eugene Teo <eugene.teo@eugeneteo.net>
Applied, thanks Eugene.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c
2006-03-16 7:07 ` Eugene Teo
2006-03-16 8:11 ` David S. Miller
@ 2006-03-16 8:24 ` Alexey Dobriyan
2006-03-16 8:38 ` David S. Miller
2006-03-16 10:14 ` Raj Kumar Yadav
2 siblings, 1 reply; 9+ messages in thread
From: Alexey Dobriyan @ 2006-03-16 8:24 UTC (permalink / raw)
To: Eugene Teo
Cc: linux-kernel, Thomas Osterried DL9SAU, Ralf Baechle DL5RB,
Hans Alblas PE1AYX
On Thu, Mar 16, 2006 at 03:07:37PM +0800, Eugene Teo wrote:
> Pointer ax is dereferenced before NULL check.
>
> Coverity bug #817
> --- linux-2.6/drivers/net/hamradio/mkiss.c
> +++ linux-2.6/drivers/net/hamradio/mkiss.c
> @@ -845,13 +845,15 @@ static int mkiss_ioctl(struct tty_struct
> unsigned int cmd, unsigned long arg)
> {
> struct mkiss *ax = mkiss_get(tty);
> - struct net_device *dev = ax->dev;
> + struct net_device *dev;
> unsigned int tmp, err;
>
> /* First make sure we're connected. */
> if (ax == NULL)
> return -ENXIO;
>
> + dev = ax->dev;
> +
Actual codepath, please... valid "ax" is plonked into ->disc_data in
mkiss_open().
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c
2006-03-16 8:24 ` Alexey Dobriyan
@ 2006-03-16 8:38 ` David S. Miller
0 siblings, 0 replies; 9+ messages in thread
From: David S. Miller @ 2006-03-16 8:38 UTC (permalink / raw)
To: adobriyan; +Cc: eugene.teo, linux-kernel, thomas, ralf, hans
From: Alexey Dobriyan <adobriyan@gmail.com>
Date: Thu, 16 Mar 2006 11:24:13 +0300
> Actual codepath, please... valid "ax" is plonked into ->disc_data in
> mkiss_open().
Please be more clear about what you are advocating.
I had to sit and think about what you were saying
before I could figure out that you were actually
suggesting that the NULL check need not be there to
begin with.
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* (no subject)
2006-03-16 7:07 ` Eugene Teo
2006-03-16 8:11 ` David S. Miller
2006-03-16 8:24 ` Alexey Dobriyan
@ 2006-03-16 10:14 ` Raj Kumar Yadav
2006-03-16 10:17 ` David S. Miller
2 siblings, 1 reply; 9+ messages in thread
From: Raj Kumar Yadav @ 2006-03-16 10:14 UTC (permalink / raw)
To: linux-kernel
unsubscribe linux-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c
2006-03-16 6:42 [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c Eugene Teo
2006-03-16 7:07 ` Eugene Teo
@ 2006-03-16 11:20 ` Ralf Baechle
2006-03-16 11:27 ` Ralf Baechle
1 sibling, 1 reply; 9+ messages in thread
From: Ralf Baechle @ 2006-03-16 11:20 UTC (permalink / raw)
To: Eugene Teo; +Cc: linux-kernel, Thomas Osterried DL9SAU, Hans Alblas PE1AYX
On Thu, Mar 16, 2006 at 02:42:11PM +0800, Eugene Teo wrote:
> Pointer ax is dereferenced before NULL check.
>
> Coverity bug #817
Coverity non-bug #817. The line discipline's ioctl method can only be
called as long as sp_get(tty) is valid. Same for mkiss.
Unless I'm wrong on the "locking rules" of the tty code that is and maybe
that unobviousness is the real reason why the patch should be applied.
Ralf
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c
2006-03-16 11:20 ` [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c Ralf Baechle
@ 2006-03-16 11:27 ` Ralf Baechle
0 siblings, 0 replies; 9+ messages in thread
From: Ralf Baechle @ 2006-03-16 11:27 UTC (permalink / raw)
To: Eugene Teo; +Cc: linux-kernel, Thomas Osterried DL9SAU, Hans Alblas PE1AYX
On Thu, Mar 16, 2006 at 11:20:45AM +0000, Ralf Baechle wrote:
> On Thu, Mar 16, 2006 at 02:42:11PM +0800, Eugene Teo wrote:
>
> > Pointer ax is dereferenced before NULL check.
> >
> > Coverity bug #817
>
> Coverity non-bug #817. The line discipline's ioctl method can only be
> called as long as sp_get(tty) is valid. Same for mkiss.
>
> Unless I'm wrong on the "locking rules" of the tty code that is and maybe
> that unobviousness is the real reason why the patch should be applied.
Oh and the same applies to Coverity bug #816.
Ralf
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-03-16 11:27 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-16 6:42 [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c Eugene Teo
2006-03-16 7:07 ` Eugene Teo
2006-03-16 8:11 ` David S. Miller
2006-03-16 8:24 ` Alexey Dobriyan
2006-03-16 8:38 ` David S. Miller
2006-03-16 10:14 ` Raj Kumar Yadav
2006-03-16 10:17 ` David S. Miller
2006-03-16 11:20 ` [PATCH] Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c Ralf Baechle
2006-03-16 11:27 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox