* [PATCH] fix pcmcia errors
@ 2001-12-06 2:16 Paul Mackerras
2001-12-06 14:39 ` Marcelo Tosatti
2001-12-07 1:10 ` Paul Mackerras
0 siblings, 2 replies; 3+ messages in thread
From: Paul Mackerras @ 2001-12-06 2:16 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: linux-kernel
Marcelo,
The PCMCIA patch that I sent you and which you included in 2.4.17-pre2
turns out to have a case where it can get a NULL pointer dereference.
The patch below fixes that. I posted this patch on the list earlier
and the person who was having the problem (Alan Ford) reported that it
fixes the problem for him, so please include this patch in your next
release.
Thanks,
Paul.
diff -urN linux-2.4.17-pre2/drivers/pcmcia/rsrc_mgr.c pmac/drivers/pcmcia/rsrc_mgr.c
--- linux-2.4.17-pre2/drivers/pcmcia/rsrc_mgr.c Sat Dec 1 15:49:24 2001
+++ pmac/drivers/pcmcia/rsrc_mgr.c Mon Dec 3 14:28:16 2001
@@ -107,17 +107,19 @@
static struct resource *resource_parent(unsigned long b, unsigned long n,
int flags, struct pci_dev *dev)
{
- struct resource res;
+ struct resource res, *pr;
- if (dev == NULL) {
- if (flags & IORESOURCE_MEM)
- return &iomem_resource;
- return &ioport_resource;
+ if (dev != NULL) {
+ res.start = b;
+ res.end = b + n - 1;
+ res.flags = flags;
+ pr = pci_find_parent_resource(dev, &res);
+ if (pr)
+ return pr;
}
- res.start = b;
- res.end = b + n - 1;
- res.flags = flags;
- return pci_find_parent_resource(dev, &res);
+ if (flags & IORESOURCE_MEM)
+ return &iomem_resource;
+ return &ioport_resource;
}
static inline int check_io_resource(unsigned long b, unsigned long n,
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] fix pcmcia errors
2001-12-06 2:16 [PATCH] fix pcmcia errors Paul Mackerras
@ 2001-12-06 14:39 ` Marcelo Tosatti
2001-12-07 1:10 ` Paul Mackerras
1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2001-12-06 14:39 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linux-kernel
Paul,
As David commented, you're using PCI code unconditionally.
Could you please fix that ?
On Thu, 6 Dec 2001, Paul Mackerras wrote:
> Marcelo,
>
> The PCMCIA patch that I sent you and which you included in 2.4.17-pre2
> turns out to have a case where it can get a NULL pointer dereference.
> The patch below fixes that. I posted this patch on the list earlier
> and the person who was having the problem (Alan Ford) reported that it
> fixes the problem for him, so please include this patch in your next
> release.
>
> Thanks,
> Paul.
>
> diff -urN linux-2.4.17-pre2/drivers/pcmcia/rsrc_mgr.c pmac/drivers/pcmcia/rsrc_mgr.c
> --- linux-2.4.17-pre2/drivers/pcmcia/rsrc_mgr.c Sat Dec 1 15:49:24 2001
> +++ pmac/drivers/pcmcia/rsrc_mgr.c Mon Dec 3 14:28:16 2001
> @@ -107,17 +107,19 @@
> static struct resource *resource_parent(unsigned long b, unsigned long n,
> int flags, struct pci_dev *dev)
> {
> - struct resource res;
> + struct resource res, *pr;
>
> - if (dev == NULL) {
> - if (flags & IORESOURCE_MEM)
> - return &iomem_resource;
> - return &ioport_resource;
> + if (dev != NULL) {
> + res.start = b;
> + res.end = b + n - 1;
> + res.flags = flags;
> + pr = pci_find_parent_resource(dev, &res);
> + if (pr)
> + return pr;
> }
> - res.start = b;
> - res.end = b + n - 1;
> - res.flags = flags;
> - return pci_find_parent_resource(dev, &res);
> + if (flags & IORESOURCE_MEM)
> + return &iomem_resource;
> + return &ioport_resource;
> }
>
> static inline int check_io_resource(unsigned long b, unsigned long n,
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] fix pcmcia errors
2001-12-06 2:16 [PATCH] fix pcmcia errors Paul Mackerras
2001-12-06 14:39 ` Marcelo Tosatti
@ 2001-12-07 1:10 ` Paul Mackerras
1 sibling, 0 replies; 3+ messages in thread
From: Paul Mackerras @ 2001-12-07 1:10 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: linux-kernel
Marcelo Tosatti writes:
> As David commented, you're using PCI code unconditionally.
>
> Could you please fix that ?
Sure, here is a new patch against 2.4.17-pre5. I tried compiling this
up on an intel box with CONFIG_PCI = n and CONFIG_PCMCIA = y and it
compiled OK. The only change from my last patch is the addition of
#ifdef CONFIG_PCI around the bit that does the
pci_find_parent_resource call.
Thanks,
Paul.
diff -urN linux-2.4.17-pre5/drivers/pcmcia/rsrc_mgr.c pmac/drivers/pcmcia/rsrc_mgr.c
--- linux-2.4.17-pre5/drivers/pcmcia/rsrc_mgr.c Fri Dec 7 07:55:31 2001
+++ pmac/drivers/pcmcia/rsrc_mgr.c Fri Dec 7 08:55:24 2001
@@ -107,17 +107,21 @@
static struct resource *resource_parent(unsigned long b, unsigned long n,
int flags, struct pci_dev *dev)
{
- struct resource res;
+#ifdef CONFIG_PCI
+ struct resource res, *pr;
- if (dev == NULL) {
- if (flags & IORESOURCE_MEM)
- return &iomem_resource;
- return &ioport_resource;
+ if (dev != NULL) {
+ res.start = b;
+ res.end = b + n - 1;
+ res.flags = flags;
+ pr = pci_find_parent_resource(dev, &res);
+ if (pr)
+ return pr;
}
- res.start = b;
- res.end = b + n - 1;
- res.flags = flags;
- return pci_find_parent_resource(dev, &res);
+#endif /* CONFIG_PCI */
+ if (flags & IORESOURCE_MEM)
+ return &iomem_resource;
+ return &ioport_resource;
}
static inline int check_io_resource(unsigned long b, unsigned long n,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-12-07 1:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-06 2:16 [PATCH] fix pcmcia errors Paul Mackerras
2001-12-06 14:39 ` Marcelo Tosatti
2001-12-07 1:10 ` Paul Mackerras
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®