All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] netfilter: nf_tables: underflow in nft_parse_u32_check()
@ 2016-10-12  6:08 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2016-10-12  6:08 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Laura Garcia Liebana
  Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller,
	netfilter-devel, coreteam, netdev, kernel-janitors

We don't want to allow negatives here.

Fixes: 36b701fae12a ('netfilter: nf_tables: validate maximum value of u32 netlink attributes')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index b70d3ea..dd55187 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -4423,7 +4423,7 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx,
  */
 unsigned int nft_parse_u32_check(const struct nlattr *attr, int max, u32 *dest)
 {
-	int val;
+	uint val;
 
 	val = ntohl(nla_get_be32(attr));
 	if (val > max)

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [patch] netfilter: nf_tables: underflow in nft_parse_u32_check()
@ 2016-10-12  6:08 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2016-10-12  6:08 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Laura Garcia Liebana
  Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller,
	netfilter-devel, coreteam, netdev, kernel-janitors

We don't want to allow negatives here.

Fixes: 36b701fae12a ('netfilter: nf_tables: validate maximum value of u32 netlink attributes')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index b70d3ea..dd55187 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -4423,7 +4423,7 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx,
  */
 unsigned int nft_parse_u32_check(const struct nlattr *attr, int max, u32 *dest)
 {
-	int val;
+	uint val;
 
 	val = ntohl(nla_get_be32(attr));
 	if (val > max)

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [patch] netfilter: nf_tables: underflow in nft_parse_u32_check()
  2016-10-12  6:08 ` Dan Carpenter
@ 2016-10-12  7:27   ` Liping Zhang
  -1 siblings, 0 replies; 8+ messages in thread
From: Liping Zhang @ 2016-10-12  7:27 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Pablo Neira Ayuso, Laura Garcia Liebana, Patrick McHardy,
	Jozsef Kadlecsik, David S. Miller,
	Netfilter Developer Mailing List, coreteam,
	Linux Kernel Network Developers, kernel-janitors

2016-10-12 14:08 GMT+08:00 Dan Carpenter <dan.carpenter@oracle.com>:
> We don't want to allow negatives here.
>
> Fixes: 36b701fae12a ('netfilter: nf_tables: validate maximum value of u32 netlink attributes')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> index b70d3ea..dd55187 100644
> --- a/net/netfilter/nf_tables_api.c
> +++ b/net/netfilter/nf_tables_api.c
> @@ -4423,7 +4423,7 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx,
>   */

I think it's better if you can convert it to follows:

>  unsigned int nft_parse_u32_check(const struct nlattr *attr, int max, u32 *dest)

int nft_parse_u32_check(const struct nlattr *attr, u32 max, u32 *dest)

>  {
> -       int val;
> +       uint val;

            u32 val;

>
>         val = ntohl(nla_get_be32(attr));
>         if (val > max)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] netfilter: nf_tables: underflow in nft_parse_u32_check()
@ 2016-10-12  7:27   ` Liping Zhang
  0 siblings, 0 replies; 8+ messages in thread
From: Liping Zhang @ 2016-10-12  7:27 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Pablo Neira Ayuso, Laura Garcia Liebana, Patrick McHardy,
	Jozsef Kadlecsik, David S. Miller,
	Netfilter Developer Mailing List, coreteam,
	Linux Kernel Network Developers, kernel-janitors

2016-10-12 14:08 GMT+08:00 Dan Carpenter <dan.carpenter@oracle.com>:
> We don't want to allow negatives here.
>
> Fixes: 36b701fae12a ('netfilter: nf_tables: validate maximum value of u32 netlink attributes')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> index b70d3ea..dd55187 100644
> --- a/net/netfilter/nf_tables_api.c
> +++ b/net/netfilter/nf_tables_api.c
> @@ -4423,7 +4423,7 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx,
>   */

I think it's better if you can convert it to follows:

>  unsigned int nft_parse_u32_check(const struct nlattr *attr, int max, u32 *dest)

int nft_parse_u32_check(const struct nlattr *attr, u32 max, u32 *dest)

>  {
> -       int val;
> +       uint val;

            u32 val;

>
>         val = ntohl(nla_get_be32(attr));
>         if (val > max)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch v2] netfilter: nf_tables: underflow in nft_parse_u32_check()
  2016-10-12  7:27   ` Liping Zhang
@ 2016-10-12  9:14     ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2016-10-12  9:14 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Laura Garcia Liebana
  Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller,
	netfilter-devel, coreteam, netdev, kernel-janitors

We don't want to allow negatives here.

Fixes: 36b701fae12a ('netfilter: nf_tables: validate maximum value of u32 netlink attributes')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: cosmetic change

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index b70d3ea..dd55187 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -4423,7 +4423,7 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx,
  */
 unsigned int nft_parse_u32_check(const struct nlattr *attr, int max, u32 *dest)
 {
-	int val;
+	u32 val;
 
 	val = ntohl(nla_get_be32(attr));
 	if (val > max)

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [patch v2] netfilter: nf_tables: underflow in nft_parse_u32_check()
@ 2016-10-12  9:14     ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2016-10-12  9:14 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Laura Garcia Liebana
  Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller,
	netfilter-devel, coreteam, netdev, kernel-janitors

We don't want to allow negatives here.

Fixes: 36b701fae12a ('netfilter: nf_tables: validate maximum value of u32 netlink attributes')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: cosmetic change

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index b70d3ea..dd55187 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -4423,7 +4423,7 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx,
  */
 unsigned int nft_parse_u32_check(const struct nlattr *attr, int max, u32 *dest)
 {
-	int val;
+	u32 val;
 
 	val = ntohl(nla_get_be32(attr));
 	if (val > max)
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [patch v2] netfilter: nf_tables: underflow in nft_parse_u32_check()
  2016-10-12  9:14     ` Dan Carpenter
@ 2016-10-17 15:40       ` Pablo Neira Ayuso
  -1 siblings, 0 replies; 8+ messages in thread
From: Pablo Neira Ayuso @ 2016-10-17 15:40 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Laura Garcia Liebana, Patrick McHardy, Jozsef Kadlecsik,
	David S. Miller, netfilter-devel, coreteam, netdev,
	kernel-janitors

On Wed, Oct 12, 2016 at 12:14:29PM +0300, Dan Carpenter wrote:
> We don't want to allow negatives here.

Applied, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch v2] netfilter: nf_tables: underflow in nft_parse_u32_check()
@ 2016-10-17 15:40       ` Pablo Neira Ayuso
  0 siblings, 0 replies; 8+ messages in thread
From: Pablo Neira Ayuso @ 2016-10-17 15:40 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Laura Garcia Liebana, Patrick McHardy, Jozsef Kadlecsik,
	David S. Miller, netfilter-devel, coreteam, netdev,
	kernel-janitors

On Wed, Oct 12, 2016 at 12:14:29PM +0300, Dan Carpenter wrote:
> We don't want to allow negatives here.

Applied, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-10-17 15:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-12  6:08 [patch] netfilter: nf_tables: underflow in nft_parse_u32_check() Dan Carpenter
2016-10-12  6:08 ` Dan Carpenter
2016-10-12  7:27 ` Liping Zhang
2016-10-12  7:27   ` Liping Zhang
2016-10-12  9:14   ` [patch v2] " Dan Carpenter
2016-10-12  9:14     ` Dan Carpenter
2016-10-17 15:40     ` Pablo Neira Ayuso
2016-10-17 15:40       ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.