From patchwork Tue May 13 14:39:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 4168161 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 62827BFF02 for ; Tue, 13 May 2014 14:39:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80F0B2020E for ; Tue, 13 May 2014 14:39:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A0A520256 for ; Tue, 13 May 2014 14:39:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934000AbaEMOjT (ORCPT ); Tue, 13 May 2014 10:39:19 -0400 Received: from andre.telenet-ops.be ([195.130.132.53]:36824 "EHLO andre.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933976AbaEMOjO (ORCPT ); Tue, 13 May 2014 10:39:14 -0400 Received: from [192.168.1.117] ([178.119.65.67]) by andre.telenet-ops.be with bizsmtp id 1SfD1o00W1T3uRu01SfDAT; Tue, 13 May 2014 16:39:13 +0200 Message-ID: <53722E91.20902@acm.org> Date: Tue, 13 May 2014 16:39:13 +0200 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Roland Dreier CC: Sagi Grimberg , Vu Pham , David Dillow , Sebastian Parschauer , linux-rdma Subject: [PATCH v2 1/9] IB/srp: Fix a sporadic crash triggered by cable pulling References: <53722E4F.7070709@acm.org> In-Reply-To: <53722E4F.7070709@acm.org> X-Enigmail-Version: 1.6 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Avoid that srp_finish_req() can encounter a pointer to a SCSI command in req->scmnd that is no longer associated with that request. If the function srp_finish_req() is invoked twice for a SCSI command that is not in flight then that would cause srp_unmap_data() to try to invoke ib_fmr_pool_unmap() with an invalid pointer as argument, resulting in a kernel oops. Reported by: Sagi Grimberg Reference: http://thread.gmane.org/gmane.linux.drivers.rdma/19068/focus=19069 Signed-off-by: Bart Van Assche Cc: Roland Dreier Cc: David Dillow Cc: Sagi Grimberg Cc: Vu Pham Cc: Sebastian Parschauer Cc: stable # 3.13+ ("IB/srp: Use SRP transport layer error recovery") --- drivers/infiniband/ulp/srp/ib_srp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 66a908b..427336a 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1594,6 +1594,8 @@ err_unmap: err_iu: srp_put_tx_iu(target, iu, SRP_IU_CMD); + req->scmnd = NULL; /* for srp_finish_req() */ + spin_lock_irqsave(&target->lock, flags); list_add(&req->list, &target->free_reqs);