linux-hams.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/1] request_region() return value missing check
@ 2006-03-17 12:30 Laurent Wandrebeck
  2006-04-29 11:58 ` Ralf Baechle DL5RB
  0 siblings, 1 reply; 2+ messages in thread
From: Laurent Wandrebeck @ 2006-03-17 12:30 UTC (permalink / raw)
  To: linux-hams

Hi,
Here is a simple patch against 2.6.16-rc6-git8.
Is adds checks about return value for two request_region() in drivers/net/hamradio/scc.c.
Please CC me on replies.
Regards.

Signed-off-by: Laurent Wandrebeck <l.wandrebeck@free.fr>

--- linux-2.6.16-rc6/drivers/net/hamradio/scc.c.ori     2006-03-17 13:11:52.000000000 +0100
+++ linux-2.6.16-rc6/drivers/net/hamradio/scc.c 2006-03-17 13:09:38.000000000 +0100
@@ -1815,8 +1815,16 @@ static int scc_net_ioctl(struct net_devi

                                if (found)
                                {
-                                       request_region(SCC_Info[2*Nchips+chan].ctrl, 1, "scc ctrl");
-                                       request_region(SCC_Info[2*Nchips+chan].data, 1, "scc data");
+                                       if (!request_region(SCC_Info[2*Nchips+chan].ctrl, 1, "scc ctrl")) {
+                                           printk(KERN_ERR "scc: unable to reserve region %d for scc ctrl\n",
+                                                            SCC_Info[2*Nchips+chan].ctrl);
+                                           return -EBUSY;
+                                       }
+                                       if (!request_region(SCC_Info[2*Nchips+chan].data, 1, "scc data")) {
+                                           printk(KERN_ERR "scc: unable to reserve region %d for scc data\n",
+                                                            SCC_Info[2*Nchips+chan].data);
+                                           return -EBUSY;
+                                       }

                                        if (Nchips+chan != 0 &&
                                            scc_net_alloc(device_name,


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch 1/1] request_region() return value missing check
  2006-03-17 12:30 [patch 1/1] request_region() return value missing check Laurent Wandrebeck
@ 2006-04-29 11:58 ` Ralf Baechle DL5RB
  0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle DL5RB @ 2006-04-29 11:58 UTC (permalink / raw)
  To: Laurent Wandrebeck; +Cc: linux-hams

On Fri, Mar 17, 2006 at 01:30:40PM +0100, Laurent Wandrebeck wrote:

> Here is a simple patch against 2.6.16-rc6-git8.
> Is adds checks about return value for two request_region() in drivers/net/hamradio/scc.c.

Several things:

 o Your mailer garbles patches, so I couldn't apply it anymore.
 o If the second request_region your patches will abort initialization
   leaving the first one region allocated.
 o The potencial abort happens in a loop so if we abort anytime other than
   during the first iteration the resources will stay allocated and the
   driver won't drive instances found earlier.

Thanks,

  Ralf

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-29 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-17 12:30 [patch 1/1] request_region() return value missing check Laurent Wandrebeck
2006-04-29 11:58 ` Ralf Baechle DL5RB

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).