From patchwork Fri Dec 10 07:20:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 397672 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBA7LAhu024690 for ; Fri, 10 Dec 2010 07:21:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753184Ab0LJHVJ (ORCPT ); Fri, 10 Dec 2010 02:21:09 -0500 Received: from mail-wy0-f174.google.com ([74.125.82.174]:45591 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753200Ab0LJHVI (ORCPT ); Fri, 10 Dec 2010 02:21:08 -0500 Received: by wyb28 with SMTP id 28so3137515wyb.19 for ; Thu, 09 Dec 2010 23:21:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=X/LgKx4q4seOrh4Azyv7+JD/FL1vgl6PE9tKO9o/Xgs=; b=xxc9St8XCekp5j/a7qD7XWnGlmoLfmjDuucepBca754tVNVB5lsN8QJcwwZDy7Xk6J 56561WjN/qmgyvqHn/qY4b7Du990j1IH76IdQd4r1+nv/LjvnEOExrvuiEMcadFmyb4O QPsz9iMXZPlaHspSOyjEXK6dEDZS4IqEVS9r8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=qjS0E6dPI8O7ZpLUcIQR2iWv/gqMbwTsad9r9d+fy5KdypHOULiGgWWUnEx3Wo53Do JYHQJd2f1TJosPCOccpaiZJCBi7a615i9wvkVjZ3MlU+8lDiULAJ7QWlZ0IS1y7M1ccE r7NGBsYjDJ1eZuOVKtOalPdYkbLKHwS3gD5eM= Received: by 10.216.154.193 with SMTP id h43mr1737856wek.69.1291965667191; Thu, 09 Dec 2010 23:21:07 -0800 (PST) Received: from bicker (h2d08.n1.ips.mtn.co.ug [41.210.173.8]) by mx.google.com with ESMTPS id p4sm1287211wer.29.2010.12.09.23.21.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 09 Dec 2010 23:21:06 -0800 (PST) Date: Fri, 10 Dec 2010 10:20:56 +0300 From: Dan Carpenter To: Roland Dreier Cc: Sean Hefty , Hal Rosenstock , Eli Cohen , linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] IB: handle -ENOMEM in forward_trap() Message-ID: <20101210072056.GZ10623@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 10 Dec 2010 07:21:10 +0000 (UTC) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index c9a8dd6..a1add16 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -211,6 +211,9 @@ static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, struct ib_mad *ma if (agent) { send_buf = ib_create_send_mad(agent, qpn, 0, 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, GFP_ATOMIC); + + if (IS_ERR(send_buf)) + return; /* * We rely here on the fact that MLX QPs don't use the * address handle after the send is posted (this is diff --git a/drivers/infiniband/hw/mthca/mthca_mad.c b/drivers/infiniband/hw/mthca/mthca_mad.c index 5648659..03a59534 100644 --- a/drivers/infiniband/hw/mthca/mthca_mad.c +++ b/drivers/infiniband/hw/mthca/mthca_mad.c @@ -171,6 +171,8 @@ static void forward_trap(struct mthca_dev *dev, if (agent) { send_buf = ib_create_send_mad(agent, qpn, 0, 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, GFP_ATOMIC); + if (IS_ERR(send_buf)) + return; /* * We rely here on the fact that MLX QPs don't use the * address handle after the send is posted (this is