Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c
PATCH 1/1 Hamradio: Fix a NULL pointer dereference in net/hamradio/mkiss.c
Pointer ax is dereferenced before NULL check.
Coverity bug #817
drivers/net/hamradio/mkiss.c renamed from drivers/net/hamradio/mkiss.c~ +5 -2
@@ -844,13 +844,16 @@ static void mkiss_close(struct tty_strucstatic 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 :
Signature · 2 lines
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); }<quote sender="Eugene Teo">
Quoted 5 lines
Pointer ax is dereferenced before NULL check.
Coverity bug #817
Signed-off-by Eugene Teo <[email protected]>
Ignore the previous patch please. Here's a resend.
--
Pointer ax is dereferenced before NULL check.
Coverity bug #817
drivers/net/hamradio/mkiss.c renamed from drivers/net/hamradio/mkiss.c~ +3 -1
@@ -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,
Signature · 2 lines
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); }From: Eugene Teo <[email protected]>
Date: Thu, 16 Mar 2006 15:07:37 +0800
Quoted 5 lines
Pointer ax is dereferenced before NULL check.
Coverity bug #817
Signed-off-by Eugene Teo <[email protected]>
Applied, thanks Eugene.
Quoted 10 lines · Eugene Teo
Pointer ax is dereferenced before NULL check.
Coverity bug #817
drivers/net/hamradio/mkiss.c +0
-0@@ -845,13 +845,15 @@ static int mkiss_ioctl(struct tty_struct unsigned int cmd, unsigned long arg) {struct mkiss *ax =mkiss_get (tty);
drivers/net/hamradio/mkiss.c static int mkiss_ioctl(struct tty_struct · line 856
Quoted 10 lines
drivers/net/hamradio/mkiss.c +3
-1-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().
David S. Miller
maintainerFrom: Alexey Dobriyan <[email protected]>
Date: Thu, 16 Mar 2006 11:24:13 +0300
Quoted 2 lines
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.
unsubscribe linux-kernel
David S. Miller
maintainerFrom: "Raj Kumar Yadav" <[email protected]>
Date: Thu, 16 Mar 2006 15:44:27 +0530
Quoted 1 line
unsubscribe linux-kernel
It's not as if every single list posting doesn't give you precise directions on how to unsubscribe properly.
Quoted 4 lines
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Sigh...
I've removed you manually from the list, why is this so hard?
Quoted 3 lines · Eugene Teo
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
Quoted 11 lines · Ralf Baechle
Quoted 3 lines · Eugene Teo
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