lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 14 Dec 2017 12:45:58 -0700
From:   David Ahern <dsahern@...il.com>
To:     Alexander Aring <aring@...atatu.com>, jhs@...atatu.com
Cc:     xiyou.wangcong@...il.com, jiri@...nulli.us, davem@...emloft.net,
        netdev@...r.kernel.org, kernel@...atatu.com
Subject: Re: [PATCHv2 net-next 02/15] lib: nlattr: set extack msg if
 validate_nla fails

On 12/14/17 11:38 AM, Alexander Aring wrote:
> This patch sets a generic netlink error message if the validation of the
> netlink attribute failed. It avoids several different settings of
> netlink messages by handle nla_parse_nested on error case.
> 
> Suggested-by: David Ahern <dsahern@...il.com>
> Signed-off-by: Alexander Aring <aring@...atatu.com>
> ---
>  lib/nlattr.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/nlattr.c b/lib/nlattr.c
> index dfa55c873c13..a2a9506b2fb7 100644
> --- a/lib/nlattr.c
> +++ b/lib/nlattr.c
> @@ -253,8 +253,10 @@ int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
>  			if (policy) {
>  				err = validate_nla(nla, maxtype, policy);
>  				if (err < 0) {
> -					if (extack)
> +					if (extack) {
> +						NL_SET_ERR_MSG(extack, "Failed to validate netlink attribute");
>  						extack->bad_attr = nla;
> +					}
>  					goto errout;
>  				}
>  			}
> 

I have a similar patch:

                        if (policy) {
                                err = validate_nla(nla, maxtype, policy);
                                if (err < 0) {
-                                       if (extack)
-                                               extack->bad_attr = nla;
+                                       NL_SET_ERR_MSG_ATTR(extack, nla,
+                                                           "Attribute
failed policy validation");
                                        goto errout;
                                }
                        }

Wording wise it notes policy validation failed but more importantly it
combines setting the error message and bad_attr into 1 macro.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ