All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Shifeng Li <lishifeng@sangfor.com.cn>
Cc: saeedm@nvidia.com, leon@kernel.org, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	ogerlitz@mellanox.com, netdev@vger.kernel.org,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	dinghui@sangfor.com.cn, lishifeng1992@126.com
Subject: Re: [PATCH] net/mlx5e: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list()
Date: Sun, 3 Dec 2023 17:50:15 +0000	[thread overview]
Message-ID: <20231203175015.GP50400@kernel.org> (raw)
In-Reply-To: <20231130094656.894412-1-lishifeng@sangfor.com.cn>

On Thu, Nov 30, 2023 at 01:46:56AM -0800, Shifeng Li wrote:
> Out_sz that the size of out buffer is calculated using query_nic_vport
> _context_in structure when driver query the MAC list. However query_nic
> _vport_context_in structure is smaller than query_nic_vport_context_out.
> When allowed_list_size is greater than 96, calling ether_addr_copy() will
> trigger an slab-out-of-bounds.
> 
> [ 1170.055866] BUG: KASAN: slab-out-of-bounds in mlx5_query_nic_vport_mac_list+0x481/0x4d0 [mlx5_core]
> [ 1170.055869] Read of size 4 at addr ffff88bdbc57d912 by task kworker/u128:1/461
> [ 1170.055870]
> [ 1170.055932] Workqueue: mlx5_esw_wq esw_vport_change_handler [mlx5_core]
> [ 1170.055936] Call Trace:
> [ 1170.055949]  dump_stack+0x8b/0xbb
> [ 1170.055958]  print_address_description+0x6a/0x270
> [ 1170.055961]  kasan_report+0x179/0x2c0
> [ 1170.056061]  mlx5_query_nic_vport_mac_list+0x481/0x4d0 [mlx5_core]
> [ 1170.056162]  esw_update_vport_addr_list+0x2c5/0xcd0 [mlx5_core]
> [ 1170.056257]  esw_vport_change_handle_locked+0xd08/0x1a20 [mlx5_core]
> [ 1170.056377]  esw_vport_change_handler+0x6b/0x90 [mlx5_core]
> [ 1170.056381]  process_one_work+0x65f/0x12d0
> [ 1170.056383]  worker_thread+0x87/0xb50
> [ 1170.056390]  kthread+0x2e9/0x3a0
> [ 1170.056394]  ret_from_fork+0x1f/0x40
> 
> Fixes: e16aea2744ab ("net/mlx5: Introduce access functions to modify/query vport mac lists")
> Cc: Ding Hui <dinghui@sangfor.com.cn>
> Signed-off-by: Shifeng Li <lishifeng@sangfor.com.cn>

Hi,

I am unsure how you calculated the 96 figure above.
But in any case I agree that the cited patch introduced
the mismatch that you describe.

Reviewed-by: Simon Horman <horms@kernel.org>

  reply	other threads:[~2023-12-03 17:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30  9:46 [PATCH] net/mlx5e: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list() Shifeng Li
2023-12-03 17:50 ` Simon Horman [this message]
2023-12-04  2:30   ` Shifeng Li
2023-12-06 21:30     ` Simon Horman
2023-12-06 21:43 ` Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231203175015.GP50400@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dinghui@sangfor.com.cn \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lishifeng1992@126.com \
    --cc=lishifeng@sangfor.com.cn \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.