From: Kangjie Lu <kjlu@umn.edu>
To: kjlu@umn.edu
Cc: pakki001@umn.edu, Doug Ledford <dledford@redhat.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
Parav Pandit <parav@mellanox.com>,
Daniel Jurgens <danielj@mellanox.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] infiniband: fix a missing check of nla_put
Date: Tue, 25 Dec 2018 20:05:48 -0600 [thread overview]
Message-ID: <20181226020549.71446-1-kjlu@umn.edu> (raw)
nla_put() may fail. The fix adds a check for its return value, and
returns -EMSGSIZE if it fails.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/infiniband/core/addr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 0dce94e3c495..32d033ebaa5b 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -178,7 +178,8 @@ static int ib_nl_ip_send_msg(struct rdma_dev_addr *dev_addr,
/* Construct the family header first */
header = skb_put(skb, NLMSG_ALIGN(sizeof(*header)));
header->ifindex = dev_addr->bound_dev_if;
- nla_put(skb, attrtype, size, daddr);
+ if (nla_put(skb, attrtype, size, daddr))
+ return -EMSGSIZE;
/* Repair the nlmsg header length */
nlmsg_end(skb, nlh);
--
2.17.2 (Apple Git-113)
next reply other threads:[~2018-12-26 2:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-26 2:05 Kangjie Lu [this message]
2018-12-26 19:50 ` [PATCH] infiniband: fix a missing check of nla_put Leon Romanovsky
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=20181226020549.71446-1-kjlu@umn.edu \
--to=kjlu@umn.edu \
--cc=danielj@mellanox.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=pakki001@umn.edu \
--cc=parav@mellanox.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