From patchwork Sun Nov 22 12:48:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: saurabh X-Patchwork-Id: 7676111 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7B8F49F750 for ; Sun, 22 Nov 2015 12:49:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BDD3820630 for ; Sun, 22 Nov 2015 12:49:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC81020671 for ; Sun, 22 Nov 2015 12:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751443AbbKVMss (ORCPT ); Sun, 22 Nov 2015 07:48:48 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:33188 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751160AbbKVMsr (ORCPT ); Sun, 22 Nov 2015 07:48:47 -0500 Received: by pabfh17 with SMTP id fh17so168634951pab.0; Sun, 22 Nov 2015 04:48:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=YpwdUECTq5bWy8HJnM4EE7ZJg7GLbZncJ0n/N3Igi/c=; b=PIVHB0agndWpnpsvUutHYD2lzY0ORkQhVgTjLdZ9yMaHsGfr9VKCmbMb0vy6tkOgdI n7T2HvMDYmbizEViyg1orJtXHZlowrYcOlyEY+0AcbyHkGDTPy9XndXJzRIstLxVQBCF f90U2X/18zs45Fd2CUMGGfn3BzTuJv9QNUP8j2/hKeQb05m6NO8mfJMFC4+/VbWKGcYl 8xK0g5IchIClCgkDiI4qFDBVuKGRIeB3EtwvPr0bjTKMujApU1q0z60GSvDhCE5A3kJV KDIxGj9zVOJxMMjqgHVTsSOaaOIcvs4iFbfGPaDtabT85eFXlCa6SLbDX9NA1vZm7Q/H o+pA== X-Received: by 10.68.221.230 with SMTP id qh6mr30273086pbc.32.1448196526740; Sun, 22 Nov 2015 04:48:46 -0800 (PST) Received: from localhost.localdomain ([122.169.229.132]) by smtp.gmail.com with ESMTPSA id qz2sm591919pab.14.2015.11.22.04.48.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Nov 2015 04:48:45 -0800 (PST) From: Saurabh Sengar To: eli@mellanox.com, dledford@redhat.com, sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Sengar Subject: [PATCH] IB/mlx5: fix null dereference Date: Sun, 22 Nov 2015 18:18:37 +0530 Message-Id: <1448196517-13341-1-git-send-email-saurabh.truth@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP removing null dereference Signed-off-by: Saurabh Sengar --- is there any better way to fix it ? as if there is no 'x' there is no way we can access 'x->lock' drivers/infiniband/hw/mlx5/qp.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 307bdbc..613a853 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -1064,13 +1064,10 @@ static void mlx5_ib_lock_cqs(struct mlx5_ib_cq *send_cq, struct mlx5_ib_cq *recv } } else { spin_lock_irq(&send_cq->lock); - __acquire(&recv_cq->lock); } } else if (recv_cq) { spin_lock_irq(&recv_cq->lock); - __acquire(&send_cq->lock); } else { - __acquire(&send_cq->lock); __acquire(&recv_cq->lock); } } @@ -1091,15 +1088,12 @@ static void mlx5_ib_unlock_cqs(struct mlx5_ib_cq *send_cq, struct mlx5_ib_cq *re spin_unlock_irq(&recv_cq->lock); } } else { - __release(&recv_cq->lock); spin_unlock_irq(&send_cq->lock); } } else if (recv_cq) { - __release(&send_cq->lock); spin_unlock_irq(&recv_cq->lock); } else { __release(&recv_cq->lock); - __release(&send_cq->lock); } }