From patchwork Thu Apr 2 14:07:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 457676 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D9102140083 for ; Fri, 3 Apr 2015 01:08:11 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753527AbbDBOIG (ORCPT ); Thu, 2 Apr 2015 10:08:06 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:36726 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753173AbbDBOIC (ORCPT ); Thu, 2 Apr 2015 10:08:02 -0400 Received: by wizk4 with SMTP id k4so16540483wiz.1 for ; Thu, 02 Apr 2015 07:08:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6HcpP4wxuhYTcT1aPLOs0tHORPBdRsUKMLnx1tHZkm4=; b=ECYn/e4PPHXpoHQEmLvZa0I6BtU11lvCV9FGxxP0Ki+FFxhsaM6t13w5Y9663b0609 vEO8CwnOzG/aek/CJiKYNNeNeBrdKUKil8ngLiJQyTEZTaKQ8xwJ6bQ285Ll7MhJjz9Q S7vtRvaHTUfAWfmrHPd0U55x1TnuD758HwMxYdfAEm85cgSd+rt8LNiBGMG6HiKPI5MV dssNDBF5iqUc5HwFK6+yhLJYbfh1RlKK3/guCuviCXupfxqiEdyxNSTvC1V0UtGpiH3c 5TmSdP2zsChaAjWr5kOKBYY4ek0CMbH6j/WiqJOGlpSslKu7OMFaqUVUJihF7vagX/4r C9mw== X-Gm-Message-State: ALoCoQmuPI0U4h7+roiaaG/f7vG6WxPL3ztMNMsSjNW/zGJDzomJqoRJTXV+PqZBdLufcRelV6Jo X-Received: by 10.195.12.196 with SMTP id es4mr14607665wjd.35.1427983681463; Thu, 02 Apr 2015 07:08:01 -0700 (PDT) Received: from localhost ([193.47.165.251]) by mx.google.com with ESMTPSA id u16sm7435583wjr.5.2015.04.02.07.08.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 02 Apr 2015 07:08:00 -0700 (PDT) From: Eli Cohen X-Google-Original-From: Eli Cohen To: davem@davemloft.net Cc: netdev@vger.kernel.org, idos@mellaox.com, amirv@mellanox.com, Eli Cohen , Saeed Mahameed Subject: [PATCH net-next 08/16] net/mlx5_core: Avoid copying outbox in aysnc command completion Date: Thu, 2 Apr 2015 17:07:26 +0300 Message-Id: <1427983654-971-9-git-send-email-eli@mellanox.com> X-Mailer: git-send-email 2.3.1 In-Reply-To: <1427983654-971-1-git-send-email-eli@mellanox.com> References: <1427983654-971-1-git-send-email-eli@mellanox.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Avoid copying to the output buffer in cmd_exec since this is done after the command is completed. Failure to do this may cause cases where the callback handler is called before the copy done by cmd_exec which then overwrites it. Reported-by: Tamer Hleihel Signed-off-by: Eli Cohen Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index 43a73d36b01d..290ae87fdef7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -1236,7 +1236,8 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, goto out_out; } - err = mlx5_copy_from_msg(out, outb, out_size); + if (!callback) + err = mlx5_copy_from_msg(out, outb, out_size); out_out: if (!callback)