From: David Miller <davem@davemloft.net>
To: dan.carpenter@oracle.com
Cc: jiri@mellanox.com, dsahern@gmail.com, idosch@mellanox.com,
petrm@mellanox.com, jakub.kicinski@netronome.com,
nikolay@cumulusnetworks.com, parav@mellanox.com,
roopa@cumulusnetworks.com, johannes.berg@intel.com,
mkubecek@suse.cz, netdev@vger.kernel.org,
linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net] net: rtnetlink: prevent underflows in do_setvfinfo()
Date: Thu, 21 Nov 2019 14:44:29 -0800 (PST) [thread overview]
Message-ID: <20191121.144429.649625073638417068.davem@davemloft.net> (raw)
In-Reply-To: <20191120123438.vxn2ngnxzpcaqot4@kili.mountain>
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 20 Nov 2019 15:34:38 +0300
> The "ivm->vf" variable is a u32, but the problem is that a number of
> drivers cast it to an int and then forget to check for negatives. An
> example of this is in the cxgb4 driver.
>
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
> 2890 static int cxgb4_mgmt_get_vf_config(struct net_device *dev,
> 2891 int vf, struct ifla_vf_info *ivi)
> ^^^^^^
> 2892 {
> 2893 struct port_info *pi = netdev_priv(dev);
> 2894 struct adapter *adap = pi->adapter;
> 2895 struct vf_info *vfinfo;
> 2896
> 2897 if (vf >= adap->num_vfs)
> ^^^^^^^^^^^^^^^^^^^
> 2898 return -EINVAL;
> 2899 vfinfo = &adap->vfinfo[vf];
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> There are 48 functions affected.
...
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
I'm going to apply this and queue it up for -stable.
The u32 conversion should happen in next.
next prev parent reply other threads:[~2019-11-21 22:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-20 12:34 [PATCH net] net: rtnetlink: prevent underflows in do_setvfinfo() Dan Carpenter
2019-11-20 16:41 ` David Ahern
2019-11-20 18:07 ` Dan Carpenter
2019-11-21 22:44 ` David Miller [this message]
2019-11-22 7:21 ` Parav Pandit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191121.144429.649625073638417068.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=dan.carpenter@oracle.com \
--cc=dsahern@gmail.com \
--cc=idosch@mellanox.com \
--cc=jakub.kicinski@netronome.com \
--cc=jiri@mellanox.com \
--cc=johannes.berg@intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=parav@mellanox.com \
--cc=petrm@mellanox.com \
--cc=roopa@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).