scc.c-patch-v1: Small scc.c patch for 2.4.0-test12-pre5

From: Hans Grobler (lobinoa.wgkssqz@vip1010.vip.at)
Date: Wed Dec 06 2000 - 07:57:56 EET

  • Next message: John Ackermann: "Questions re pseudo-ports"

    patch version 1:
      - scc_cleanup_driver: For the case when the driver is loaded and
          immediately unload, fix the memory leak of scc->dev.
      - scc_cleanup_driver: The NULL check during channel deregistering is not
          sufficient. The pointer 'scc' will never be NULL as it points to
          a static structure. To prevent invalid release_region calls, check
          to see if the ports where requested (i.e. ->ctrl != 0).

    more to follow after reader comments... :)

    diff -u3Nr -X dontdiff linux-2.4.0-test12-pre5.orig/drivers/net/hamradio/scc.c linux-2.4.0-test12-pre5/drivers/net/hamradio/scc.c
    --- linux-2.4.0-test12-pre5.orig/drivers/net/hamradio/scc.c Thu Oct 12 23:05:34 2000
    +++ linux-2.4.0-test12-pre5/drivers/net/hamradio/scc.c Wed Dec 6 07:52:32 2000
    @@ -2193,7 +2193,10 @@
             cli();

             if (Nchips == 0)
    + {
                     unregister_netdev(SCC_Info[0].dev);
    + kfree(SCC_Info[0].dev);
    + }

             for (k = 0; k < Nchips; k++)
                     if ( (ctrl = SCC_ctrl[k].chan_A) )
    @@ -2206,15 +2209,15 @@
             for (k = 0; k < Nchips*2; k++)
             {
                     scc = &SCC_Info[k];
    - if (scc)
    + if (scc->ctrl)
                     {
                             release_region(scc->ctrl, 1);
                             release_region(scc->data, 1);
    - if (scc->dev)
    - {
    - unregister_netdev(scc->dev);
    - kfree(scc->dev);
    - }
    + }
    + if (scc->dev)
    + {
    + unregister_netdev(scc->dev);
    + kfree(scc->dev);
                     }
             }

    -
    To unsubscribe from this list: send the line "unsubscribe linux-hams" in
    the body of a message to llxco.epfhegoej@telegenix.com



    This archive was generated by hypermail 2b30 : Wed Dec 06 2000 - 08:43:45 EET