* [PATCH] infiniband: fix a missing check of nla_put
@ 2018-12-26 2:05 Kangjie Lu
2018-12-26 19:50 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2018-12-26 2:05 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Doug Ledford, Jason Gunthorpe, Leon Romanovsky,
Parav Pandit, Daniel Jurgens, linux-rdma, linux-kernel
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)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] infiniband: fix a missing check of nla_put
2018-12-26 2:05 [PATCH] infiniband: fix a missing check of nla_put Kangjie Lu
@ 2018-12-26 19:50 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2018-12-26 19:50 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Doug Ledford, Jason Gunthorpe, Parav Pandit,
Daniel Jurgens, linux-rdma, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]
On Tue, Dec 25, 2018 at 08:05:48PM -0600, Kangjie Lu wrote:
> 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(-)
The same comment as on previous patch, lack of netlink cancel.
Thanks
>
> 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)
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-26 19:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-26 2:05 [PATCH] infiniband: fix a missing check of nla_put Kangjie Lu
2018-12-26 19:50 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox