LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
@ 2007-03-24 15:52 Noriaki TAKAMIYA
2007-03-24 15:54 ` [PATCH 1/2] [USB] [PL2303]: fixed to skip NULL entry in pl2303_shutdown Noriaki TAKAMIYA
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Noriaki TAKAMIYA @ 2007-03-24 15:52 UTC (permalink / raw)
To: linux-usb-devel; +Cc: linux-kernel, usagi-core
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/2] [USB] [PL2303]: fixed to skip NULL entry in pl2303_shutdown.
2007-03-24 15:52 [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port Noriaki TAKAMIYA
@ 2007-03-24 15:54 ` Noriaki TAKAMIYA
2007-03-24 15:56 ` (usagi-core 32633) " Noriaki TAKAMIYA
2007-03-24 16:01 ` Noriaki TAKAMIYA
2007-03-24 15:55 ` [PATCH 2/2] [USB] [SERIAL]: fixed to skip NULL port entry in struct usb_serial_port Noriaki TAKAMIYA
2007-03-24 21:22 ` [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port Greg KH
2 siblings, 2 replies; 12+ messages in thread
From: Noriaki TAKAMIYA @ 2007-03-24 15:54 UTC (permalink / raw)
To: linux-usb-devel; +Cc: linux-kernel, usagi-core
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(-)
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 83dfae9..d631f8c 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -905,6 +905,8 @@ static void pl2303_shutdown(struct usb_s
dbg("%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);
--
1.4.4
--
Noriaki TAKAMIYA
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/2] [USB] [SERIAL]: fixed to skip NULL port entry in struct usb_serial_port.
2007-03-24 15:52 [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port Noriaki TAKAMIYA
2007-03-24 15:54 ` [PATCH 1/2] [USB] [PL2303]: fixed to skip NULL entry in pl2303_shutdown Noriaki TAKAMIYA
@ 2007-03-24 15:55 ` Noriaki TAKAMIYA
2007-03-24 15:57 ` (usagi-core 32634) " Noriaki TAKAMIYA
2007-03-24 21:22 ` [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port Greg KH
2 siblings, 1 reply; 12+ messages in thread
From: Noriaki TAKAMIYA @ 2007-03-24 15:55 UTC (permalink / raw)
To: linux-usb-devel; +Cc: linux-kernel, usagi-core
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(-)
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 32acbae..85ed5ef 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -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)
--
1.4.4
--
Noriaki TAKAMIYA
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (usagi-core 32633) [PATCH 1/2] [USB] [PL2303]: fixed to skip NULL entry in pl2303_shutdown.
2007-03-24 15:54 ` [PATCH 1/2] [USB] [PL2303]: fixed to skip NULL entry in pl2303_shutdown Noriaki TAKAMIYA
@ 2007-03-24 15:56 ` Noriaki TAKAMIYA
2007-03-24 16:01 ` Noriaki TAKAMIYA
1 sibling, 0 replies; 12+ messages in thread
From: Noriaki TAKAMIYA @ 2007-03-24 15:56 UTC (permalink / raw)
To: linux-usb-devel; +Cc: linux-kernel, usagi-core
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.
Signed-off-by: Noriaki TAKAMIYA <takamiya@po.ntts.co.jp>
---
drivers/usb/serial/pl2303.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 83dfae9..d631f8c 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -905,6 +905,8 @@ static void pl2303_shutdown(struct usb_s
dbg("%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);
--
1.4.4
--
Noriaki TAKAMIYA
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (usagi-core 32634) [PATCH 2/2] [USB] [SERIAL]: fixed to skip NULL port entry in struct usb_serial_port.
2007-03-24 15:55 ` [PATCH 2/2] [USB] [SERIAL]: fixed to skip NULL port entry in struct usb_serial_port Noriaki TAKAMIYA
@ 2007-03-24 15:57 ` Noriaki TAKAMIYA
0 siblings, 0 replies; 12+ messages in thread
From: Noriaki TAKAMIYA @ 2007-03-24 15:57 UTC (permalink / raw)
To: linux-usb-devel; +Cc: linux-kernel, usagi-core
Sorry for resending.
Hi,
This patch fixes to skip serial->port[i] if it is set NULL.
Signed-off-by: Noriaki TAKAMIYA <takamiya@po.ntts.co.jp>
---
include/linux/usb/serial.h | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 32acbae..85ed5ef 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -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)
--
1.4.4
--
Noriaki TAKAMIYA
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (usagi-core 32633) [PATCH 1/2] [USB] [PL2303]: fixed to skip NULL entry in pl2303_shutdown.
2007-03-24 15:54 ` [PATCH 1/2] [USB] [PL2303]: fixed to skip NULL entry in pl2303_shutdown Noriaki TAKAMIYA
2007-03-24 15:56 ` (usagi-core 32633) " Noriaki TAKAMIYA
@ 2007-03-24 16:01 ` Noriaki TAKAMIYA
1 sibling, 0 replies; 12+ messages in thread
From: Noriaki TAKAMIYA @ 2007-03-24 16:01 UTC (permalink / raw)
To: linux-usb-devel; +Cc: linux-kernel, usagi-core
Sorry 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(-)
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 83dfae9..d631f8c 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -905,6 +905,8 @@ static void pl2303_shutdown(struct usb_s
dbg("%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);
--
1.4.4
--
Noriaki TAKAMIYA
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
2007-03-24 15:52 [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port Noriaki TAKAMIYA
2007-03-24 15:54 ` [PATCH 1/2] [USB] [PL2303]: fixed to skip NULL entry in pl2303_shutdown Noriaki TAKAMIYA
2007-03-24 15:55 ` [PATCH 2/2] [USB] [SERIAL]: fixed to skip NULL port entry in struct usb_serial_port Noriaki TAKAMIYA
@ 2007-03-24 21:22 ` Greg KH
2007-03-25 5:47 ` (usagi-core 32638) " Noriaki TAKAMIYA
2 siblings, 1 reply; 12+ messages in thread
From: Greg KH @ 2007-03-24 21:22 UTC (permalink / raw)
To: Noriaki TAKAMIYA; +Cc: linux-usb-devel, usagi-core, linux-kernel
On Sun, Mar 25, 2007 at 12:52:27AM +0900, Noriaki TAKAMIYA wrote:
> 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.
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (usagi-core 32638) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
2007-03-24 21:22 ` [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port Greg KH
@ 2007-03-25 5:47 ` Noriaki TAKAMIYA
2007-03-25 15:55 ` Greg KH
0 siblings, 1 reply; 12+ messages in thread
From: Noriaki TAKAMIYA @ 2007-03-25 5:47 UTC (permalink / raw)
To: usagi-core, greg; +Cc: linux-usb-devel, linux-kernel
Hi,
>> 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 serial usb_serial_port.]
>> Greg KH <greg@kroah.com> 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (usagi-core 32638) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
2007-03-25 5:47 ` (usagi-core 32638) " Noriaki TAKAMIYA
@ 2007-03-25 15:55 ` Greg KH
2007-03-26 0:38 ` (usagi-core 32640) " Noriaki TAKAMIYA
0 siblings, 1 reply; 12+ messages in thread
From: Greg KH @ 2007-03-25 15:55 UTC (permalink / raw)
To: Noriaki TAKAMIYA; +Cc: usagi-core, linux-usb-devel, linux-kernel
On Sun, Mar 25, 2007 at 02:47:40PM +0900, Noriaki TAKAMIYA wrote:
> Hi,
>
> >> 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 serial usb_serial_port.]
> >> Greg KH <greg@kroah.com> 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (usagi-core 32640) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
2007-03-25 15:55 ` Greg KH
@ 2007-03-26 0:38 ` Noriaki TAKAMIYA
2007-03-27 22:51 ` Greg KH
0 siblings, 1 reply; 12+ messages in thread
From: Noriaki TAKAMIYA @ 2007-03-26 0:38 UTC (permalink / raw)
To: usagi-core, greg; +Cc: linux-usb-devel, linux-kernel
Hi,
>> 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 serial usb_serial_port.]
>> Greg KH <greg@kroah.com> 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (usagi-core 32640) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
2007-03-26 0:38 ` (usagi-core 32640) " Noriaki TAKAMIYA
@ 2007-03-27 22:51 ` Greg KH
2007-03-28 1:36 ` (usagi-core 32652) " Noriaki TAKAMIYA
0 siblings, 1 reply; 12+ messages in thread
From: Greg KH @ 2007-03-27 22:51 UTC (permalink / raw)
To: Noriaki TAKAMIYA; +Cc: usagi-core, linux-usb-devel, linux-kernel
On Mon, Mar 26, 2007 at 09:38:15AM +0900, Noriaki TAKAMIYA wrote:
> Hi,
>
> >> 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 serial usb_serial_port.]
> >> Greg KH <greg@kroah.com> 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.
I don't think it is really necessary, do you?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (usagi-core 32652) Re: [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port.
2007-03-27 22:51 ` Greg KH
@ 2007-03-28 1:36 ` Noriaki TAKAMIYA
0 siblings, 0 replies; 12+ messages in thread
From: Noriaki TAKAMIYA @ 2007-03-28 1:36 UTC (permalink / raw)
To: linux-usb-devel, linux-kernel; +Cc: usagi-core
>> 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 serial usb_serial_port.]
>> Greg KH <greg@kroah.com> 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
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2007-03-28 2:57 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-24 15:52 [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port Noriaki TAKAMIYA
2007-03-24 15:54 ` [PATCH 1/2] [USB] [PL2303]: fixed to skip NULL entry in pl2303_shutdown Noriaki TAKAMIYA
2007-03-24 15:56 ` (usagi-core 32633) " Noriaki TAKAMIYA
2007-03-24 16:01 ` Noriaki TAKAMIYA
2007-03-24 15:55 ` [PATCH 2/2] [USB] [SERIAL]: fixed to skip NULL port entry in struct usb_serial_port Noriaki TAKAMIYA
2007-03-24 15:57 ` (usagi-core 32634) " Noriaki TAKAMIYA
2007-03-24 21:22 ` [linux-usb-devel] [PATCH 0/2] [SERIAL] [USB] fixed to skip NULL entry in struct serial usb_serial_port Greg KH
2007-03-25 5:47 ` (usagi-core 32638) " Noriaki TAKAMIYA
2007-03-25 15:55 ` Greg KH
2007-03-26 0:38 ` (usagi-core 32640) " Noriaki TAKAMIYA
2007-03-27 22:51 ` Greg KH
2007-03-28 1:36 ` (usagi-core 32652) " Noriaki TAKAMIYA
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).