fixed to skip NULL entry in struct serial usb_serial_port.
Subsystems (2)
cover fixed to skip NULL entry in struct serial usb_serial_port.
Hi,
When I boot using linux-2.6.21-rc4 on ThinkPad T41 with pl2303 USB serial device plugged in, the kernel crashes.
The reason is struct usb_serial_port is referenced without checking whether it is NULL or not.
Regards,
--
Noriaki TAKAMIYA
PATCH 1/2 : fixed to skip NULL entry in pl2303_shutdown.
Hi,
While booting, this entry is set to NULL in destroy_serial(), but serial->port is referred again in pl2303_shutdown() via serial->type->shutdown.
--- drivers/usb/serial/pl2303.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/usb/serial/pl2303.c +2 -0
@@ -905,6 +905,8 @@ static void pl2303_shutdown(struct usb_sdbg ("%s" , __FUNCTION__);for (i =0 ; i < serial->num_ports; ++i) { +if (!serial->port[i]) +continue ; priv =usb_get_serial_port_data (serial->port[i]);if (priv) {pl2303_buf_free (priv->buf);
Signature · 4 lines
1.4.4 -- Noriaki TAKAMIYA
Re: (usagi-core 32633) [PATCH 1/2] [USB] [PL2303]: fixed to skip NULL entry in pl2303_shutdown.
Sorry for resending.
While booting, this entry is set to NULL in destroy_serial(), but serial->port is referred again in pl2303_shutdown() via serial->type->shutdown.
--- drivers/usb/serial/pl2303.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/usb/serial/pl2303.c +2 -0
@@ -905,6 +905,8 @@ static void pl2303_shutdown(struct usb_sdbg ("%s" , __FUNCTION__);for (i =0 ; i < serial->num_ports; ++i) { +if (!serial->port[i]) +continue ; priv =usb_get_serial_port_data (serial->port[i]);if (priv) {pl2303_buf_free (priv->buf);
Signature · 4 lines
1.4.4 -- Noriaki TAKAMIYA
Re: (usagi-core 32633) [PATCH 1/2] [USB] [PL2303]: fixed to skip NULL entry in pl2303_shutdown.
In reply to Noriaki TAKAMIYASorry for resending
Hi,
While booting, this entry is set to NULL in destroy_serial(), but serial->port is referred again in pl2303_shutdown() via serial->type->shutdown.
--- drivers/usb/serial/pl2303.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/usb/serial/pl2303.c +2 -0
@@ -905,6 +905,8 @@ static void pl2303_shutdown(struct usb_sdbg ("%s" , __FUNCTION__);for (i =0 ; i < serial->num_ports; ++i) { +if (!serial->port[i]) +continue ; priv =usb_get_serial_port_data (serial->port[i]);if (priv) {pl2303_buf_free (priv->buf);
Signature · 4 lines
1.4.4 -- Noriaki TAKAMIYA
PATCH 2/2 : fixed to skip NULL port entry in struct usb_serial_port.
In reply to Noriaki TAKAMIYAHi,
This patch fixes to skip serial->port[i] if it is set NULL.
--- include/linux/usb/serial.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
include/linux/usb/serial.h +4 -1
@@ -99,7 +99,10 @@ struct usb_serial_port {/* get and set the port private data pointer helper functions */ static inline void *usb_get_serial_port_data (struct usb_serial_port *port) { -return dev_get_drvdata (&port->dev); +if (port) +return dev_get_drvdata (&port->dev); +else +return NULL ; }static inline void usb_set_serial_port_data (struct usb_serial_port *port,void *data)
Signature · 4 lines
1.4.4 -- Noriaki TAKAMIYA
Re: (usagi-core 32634) [PATCH 2/2] [USB] [SERIAL]: fixed to skip NULL port entry in struct usb_serial_port.
Sorry for resending.
Hi,
This patch fixes to skip serial->port[i] if it is set NULL.
--- include/linux/usb/serial.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
include/linux/usb/serial.h +4 -1
@@ -99,7 +99,10 @@ struct usb_serial_port {/* get and set the port private data pointer helper functions */ static inline void *usb_get_serial_port_data (struct usb_serial_port *port) { -return dev_get_drvdata (&port->dev); +if (port) +return dev_get_drvdata (&port->dev); +else +return NULL ; }static inline void usb_set_serial_port_data (struct usb_serial_port *port,void *data)
Signature · 4 lines
1.4.4 -- Noriaki TAKAMIYA
Quoted 7 lines · Noriaki TAKAMIYA
Hi,
When I boot using linux-2.6.21-rc4 on ThinkPad T41 with pl2303 USB serial device plugged in, the kernel crashes.
The reason is struct
usb_serial_portis referenced without checking whether it is NULL or not.
This should already be fixed in the -git snapshots that have come out after 2.6.21-rc4. Can you test them to verify this?
thanks,
greg k-h
Re: (usagi-core 32638) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
Hi,
Quoted 6 lines
Quoted 3 lines
Sat, 24 Mar 2007 14:22:53 -0700
[Subject: (usagi-core 32638) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serialusb_serial_port.] Greg KH <[email protected]> wrote...This should already be fixed in the -git snapshots that have come out after 2.6.21-rc4. Can you test them to verify this?
Yes, this problem was already fixed.
Thanks.
--
Noriaki TAKAMIYA
Re: (usagi-core 32638) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
Quoted 10 lines · Noriaki TAKAMIYA
Hi,
Quoted 6 lines
Quoted 3 lines
Sat, 24 Mar 2007 14:22:53 -0700
[Subject: (usagi-core 32638) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serialusb_serial_port.] Greg KH <[email protected]> wrote...This should already be fixed in the -git snapshots that have come out after 2.6.21-rc4. Can you test them to verify this?
Yes, this problem was already fixed.
Great, thanks for testing. So I guess both of these patches are no longer necessary, right?
thanks,
greg k-h
Re: (usagi-core 32640) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
Hi,
Quoted 8 lines
Quoted 5 lines
Sun, 25 Mar 2007 08:55:21 -0700
[Subject: (usagi-core 32640) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serialusb_serial_port.] Greg KH <[email protected]> wrote...Yes, this problem was already fixed.
Great, thanks for testing. So I guess both of these patches are no longer necessary, right?
I think so. But I wonder if usb_get_serial_port_data() should check the argument for the other drivers.
Regards,
--
Noriaki TAKAMIYA
Re: (usagi-core 32640) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
Quoted 6 lines · Noriaki TAKAMIYA
Hi,
Quoted 3 lines
Quoted 3 lines
Sun, 25 Mar 2007 08:55:21 -0700
[Subject: (usagi-core 32640) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serialusb_serial_port.] Greg KH <[email protected]> wrote...
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Yes, this problem was already fixed.
Great, thanks for testing. So I guess both of these patches are no longer necessary, right?
I think so. But I wonder if
usb_get_serial_port_data()should check the argument for the other drivers.
I don't think it is really necessary, do you?
thanks,
greg k-h
Re: (usagi-core 32652) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
Quoted 8 lines
Quoted 6 lines
Tue, 27 Mar 2007 15:51:39 -0700
[Subject: (usagi-core 32652) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serialusb_serial_port.] Greg KH <[email protected]> wrote...I think so. But I wonder if
usb_get_serial_port_data()should check the argument for the other drivers.I don't think it is really necessary, do you?
I see.
--
Noriaki TAKAMIYA