Re: [v2 PATCH] ucc_geth: fix ethtool set ring param bug

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ben Hutchings
Date: Thursday, September 2, 2010 - 11:04 am

On Fri, 2010-09-03 at 00:02 +0800, Liang Li wrote:
[...]
[...]

If ucc_geth_open() failed you MUST NOT call ucc_geth_close(), but that
is what dev_close() is going to do.  But the device is still flagged as
running so 'ifconfig down' is going to call dev_close() as well.  There
is no way out.

This is why I said you must call dev_close() and then dev_open()
instead.  Then if dev_open() fails, just print the error, e.g.:

               dev_close(netdev);
               ret = dev_open(netdev);
               if (ret)
                       netdev_err(netdev,
                                  "uec_set_ringparam: failed to restart"
                                  " interface with new ring parameters\n");

(And I think this really is a serious error, hence the 'err' rather than
'warning' severity.)

(By the way, I noticed there are other places where ucc_geth_close() and
ucc_geth_open() are called, without error checking.  These are also
bugs, but that doesn't justify adding new bugs.)

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] ucc_geth: fix ethtool set ring param bug, Liang Li, (Mon Aug 30, 7:47 am)
Re: [PATCH] ucc_geth: fix ethtool set ring param bug, Ben Hutchings, (Tue Aug 31, 7:41 am)
Re: [PATCH] ucc_geth: fix ethtool set ring param bug, Ben Hutchings, (Tue Aug 31, 8:23 am)
Re: [v1 PATCH] ucc_geth: fix ethtool set ring param bug, Ben Hutchings, (Wed Sep 1, 6:42 am)
Re: [v1 PATCH] ucc_geth: fix ethtool set ring param bug, Ben Hutchings, (Thu Sep 2, 4:11 am)
Re: [v1 PATCH] ucc_geth: fix ethtool set ring param bug, Ben Hutchings, (Thu Sep 2, 9:32 am)
Re: [v2 PATCH] ucc_geth: fix ethtool set ring param bug, Ben Hutchings, (Thu Sep 2, 11:04 am)