netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] net/mlx5: allocate enough space in
       [not found] <20181019200638.dea3r4uocbij6d6j@kili.mountain>
@ 2018-10-20 20:37 ` Or Gerlitz
  2018-10-21 10:56   ` Or Gerlitz
  0 siblings, 1 reply; 5+ messages in thread
From: Or Gerlitz @ 2018-10-20 20:37 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Saeed Mahameed, Paul Blakey, kernel-janitors, Linux Netdev List,
	Leon Romanovsky

On Fri, Oct 19, 2018 at 11:08 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> FDB_MAX_CHAIN is 3.  We wanted to allocate enough memory to hold four
> structs but there are missing parentheses so we only allocate enough
> memory for three structs and the first byte of the fourth one.

yeah, seems that we were wrong here and the fix is correct, at some
point I saw Kasan
screams but it was gone later, let me look, thanks for pointing it out.



> Fixes: 328edb499f99 ("net/mlx5: Split FDB fast path prio to multiple namespaces")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> index 67ba4c975d81..9d73eb955f75 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> @@ -2470,7 +2470,7 @@ static int init_fdb_root_ns(struct mlx5_flow_steering *steering)
>                 return -ENOMEM;
>
>         steering->fdb_sub_ns = kzalloc(sizeof(steering->fdb_sub_ns) *
> -                                      FDB_MAX_CHAIN + 1, GFP_KERNEL);
> +                                      (FDB_MAX_CHAIN + 1), GFP_KERNEL);
>         if (!steering->fdb_sub_ns)
>                 return -ENOMEM;
>
> --
> 2.11.0
>

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

* Re: [PATCH] net/mlx5: allocate enough space in
  2018-10-20 20:37 ` [PATCH] net/mlx5: allocate enough space in Or Gerlitz
@ 2018-10-21 10:56   ` Or Gerlitz
  2018-10-22  5:23     ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Or Gerlitz @ 2018-10-21 10:56 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Saeed Mahameed, Paul Blakey, kernel-janitors, Linux Netdev List,
	Leon Romanovsky

On Sat, Oct 20, 2018 at 11:37 PM Or Gerlitz <gerlitz.or@gmail.com> wrote:
> On Fri, Oct 19, 2018 at 11:08 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > FDB_MAX_CHAIN is 3.  We wanted to allocate enough memory to hold four
> > structs but there are missing parentheses so we only allocate enough
> > memory for three structs and the first byte of the fourth one.
>
> yeah, seems that we were wrong here and the fix is correct, at some
> point I saw Kasan screams but it was gone later, let me look, thanks for pointing it out.

OK, here's the kasan note:

[  289.005141] BUG: KASAN: slab-out-of-bounds in
mlx5_init_fs+0x6a7/0x1176 [mlx5_core]
[  289.005244] Write of size 8 at addr ffff8806cfb70e58 by task modprobe/6186

my .config was like this w.r.t kasan:

CONFIG_KASAN_SHADOW_OFFSET=0xdffffc0000000000
CONFIG_HAVE_ARCH_KASAN=y
CONFIG_KASAN=y
# CONFIG_KASAN_EXTRA is not set
CONFIG_KASAN_OUTLINE=y
# CONFIG_KASAN_INLINE is not set
# CONFIG_TEST_KASAN is not set

where now, when I changed it to be:

CONFIG_KASAN_SHADOW_OFFSET=0xdffffc0000000000
CONFIG_HAVE_ARCH_KASAN=y
CONFIG_KASAN=y
CONFIG_KASAN_EXTRA=y
# CONFIG_KASAN_OUTLINE is not set
CONFIG_KASAN_INLINE=y
# CONFIG_TEST_KASAN is not set

Kasan is there to spot the bug.

I will re-post your patch, this time to netdev since the original
commit is there
and so should be the fix, thanks for reporting/fixing!

Or.

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

* Re: [PATCH] net/mlx5: allocate enough space in
  2018-10-21 10:56   ` Or Gerlitz
@ 2018-10-22  5:23     ` Dan Carpenter
  2018-10-22  6:18       ` Or Gerlitz
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2018-10-22  5:23 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: Saeed Mahameed, Paul Blakey, kernel-janitors, Linux Netdev List,
	Leon Romanovsky

On Sun, Oct 21, 2018 at 01:56:26PM +0300, Or Gerlitz wrote:
> I will re-post your patch, this time to netdev since the original
> commit is there
> and so should be the fix, thanks for reporting/fixing!

I didn't realize it had been posted to netdev already so I deliberately
left that off the CC.  If Dave hasn't applied the original (he probably
has now because he is so quick) then it's fine by me if you fold them
together.

regards,
dan carpenter

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

* Re: [PATCH] net/mlx5: allocate enough space in
  2018-10-22  5:23     ` Dan Carpenter
@ 2018-10-22  6:18       ` Or Gerlitz
  2018-10-22  6:41         ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Or Gerlitz @ 2018-10-22  6:18 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Saeed Mahameed, Paul Blakey, kernel-janitors, Linux Netdev List,
	Leon Romanovsky

On Mon, Oct 22, 2018 at 8:23 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> On Sun, Oct 21, 2018 at 01:56:26PM +0300, Or Gerlitz wrote:
> > I will re-post your patch, this time to netdev since the original
> > commit is there
> > and so should be the fix, thanks for reporting/fixing!
>
> I didn't realize it had been posted to netdev already so I deliberately
> left that off the CC.  If Dave hasn't applied the original (he probably

you didn't post it to netdev, I don't see how he could have got it


> has now because he is so quick) then it's fine by me if you fold them
> together.
>
> regards,
> dan carpenter
>

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

* Re: [PATCH] net/mlx5: allocate enough space in
  2018-10-22  6:18       ` Or Gerlitz
@ 2018-10-22  6:41         ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2018-10-22  6:41 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: Saeed Mahameed, Paul Blakey, kernel-janitors, Linux Netdev List,
	Leon Romanovsky

On Mon, Oct 22, 2018 at 09:18:43AM +0300, Or Gerlitz wrote:
> On Mon, Oct 22, 2018 at 8:23 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > On Sun, Oct 21, 2018 at 01:56:26PM +0300, Or Gerlitz wrote:
> > > I will re-post your patch, this time to netdev since the original
> > > commit is there
> > > and so should be the fix, thanks for reporting/fixing!
> >
> > I didn't realize it had been posted to netdev already so I deliberately
> > left that off the CC.  If Dave hasn't applied the original (he probably
> 
> you didn't post it to netdev, I don't see how he could have got it
> 

I meant commit 328edb499f99 ("net/mlx5: Split FDB fast path prio to
multiple namespaces").  It turns out that Dave has applied that, but I
was expecting to see his S-o-B on it.

It's hard for me to know which tree patches are applied to.

Also I see that I screwed up the subject.  Thanks for fixing that.

regards,
dan carpenter

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

end of thread, other threads:[~2018-10-22 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20181019200638.dea3r4uocbij6d6j@kili.mountain>
2018-10-20 20:37 ` [PATCH] net/mlx5: allocate enough space in Or Gerlitz
2018-10-21 10:56   ` Or Gerlitz
2018-10-22  5:23     ` Dan Carpenter
2018-10-22  6:18       ` Or Gerlitz
2018-10-22  6:41         ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).