[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B732F@saturn3.aculab.com>
Date: Fri, 13 Sep 2013 09:58:25 +0100
From: "David Laight" <David.Laight@...LAB.COM>
To: "Dan Carpenter" <dan.carpenter@...cle.com>,
"Jeff Kirsher" <jeffrey.t.kirsher@...el.com>
Cc: "Jesse Brandeburg" <jesse.brandeburg@...el.com>,
"Bruce Allan" <bruce.w.allan@...el.com>,
"Carolyn Wyborny" <carolyn.wyborny@...el.com>,
"Don Skidmore" <donald.c.skidmore@...el.com>,
"Greg Rose" <gregory.v.rose@...el.com>,
"Peter P Waskiewicz Jr" <peter.p.waskiewicz.jr@...el.com>,
"Alex Duyck" <alexander.h.duyck@...el.com>,
"John Ronciak" <john.ronciak@...el.com>,
"Tushar Dave" <tushar.n.dave@...el.com>,
"David S. Miller" <davem@...emloft.net>,
"Mitch Williams" <mitch.a.williams@...el.com>,
"Patrick McHardy" <kaber@...sh.net>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
<e1000-devel@...ts.sourceforge.net>, <netdev@...r.kernel.org>,
<kernel-janitors@...r.kernel.org>
Subject: RE: [patch -stable] igbvf: integer wrapping bug setting the mtu
> If new_mtu is very large then "new_mtu + ETH_HLEN + ETH_FCS_LEN" can
> wrap and the check on the next line can underflow. This is one of those
> bugs which can be triggered by the user if you have namespaces
> configured.
>
> This is a static checker fix and I'm not sure what the impact is.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
>
> diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
> index 95d5430..24e3883 100644
> --- a/drivers/net/ethernet/intel/igbvf/netdev.c
> +++ b/drivers/net/ethernet/intel/igbvf/netdev.c
> @@ -2342,7 +2342,7 @@ static struct net_device_stats *igbvf_get_stats(struct net_device *netdev)
> static int igbvf_change_mtu(struct net_device *netdev, int new_mtu)
> {
> struct igbvf_adapter *adapter = netdev_priv(netdev);
> - int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
> + unsigned int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
>
> if ((new_mtu < 68) || (max_frame > MAX_JUMBO_FRAME_SIZE)) {
> dev_err(&adapter->pdev->dev, "Invalid MTU setting\n");
It is safer to check:
if ((new_mtu < 68) || (new_mtu > MAX_JUMBO_FRAME_SIZE - ETH_HLEN - ETH_FCS_LEN)) {
David
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists