Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
crypto: user - no parsing of CRYPTO_MSG_GETALG
Browse files Browse the repository at this point in the history
The CRYPTO_MSG_GETALG netlink message type provides a buffer to the
kernel to retrieve information from the kernel. The data buffer will not
provide any input and will not be read. Hence the nlmsg_parse is not
applicable to this netlink message type.

This patch fixes the following kernel log message when using this
netlink interface:

netlink: 208 bytes leftover after parsing attributes in process `XXX'.

Patch successfully tested with libkcapi from [1] which uses
CRYPTO_MSG_GETALG to obtain cipher-specific information from the kernel.

[1] http://www.chronox.de/libkcapi.html

Signed-off-by: Stephan Mueller <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
smuellerDD authored and herbertx committed May 31, 2016
1 parent 1a445e8 commit eed1e1a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crypto/crypto_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,12 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
return err;
}

err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX,
crypto_policy);
if (err < 0)
return err;
if (type != (CRYPTO_MSG_GETALG - CRYPTO_MSG_BASE)) {
err = nlmsg_parse(nlh, crypto_msg_min[type], attrs,
CRYPTOCFGA_MAX, crypto_policy);
if (err < 0)
return err;
}

if (link->doit == NULL)
return -EINVAL;
Expand Down

0 comments on commit eed1e1a

Please sign in to comment.