From patchwork Thu Oct 13 06:38:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jitendra Bhivare X-Patchwork-Id: 9374441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4F4DB60839 for ; Thu, 13 Oct 2016 06:48:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C25B29897 for ; Thu, 13 Oct 2016 06:48:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BB1529899; Thu, 13 Oct 2016 06:48:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0C7029897 for ; Thu, 13 Oct 2016 06:48:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751337AbcJMGsr (ORCPT ); Thu, 13 Oct 2016 02:48:47 -0400 Received: from mail-qt0-f176.google.com ([209.85.216.176]:35795 "EHLO mail-qt0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750909AbcJMGsq (ORCPT ); Thu, 13 Oct 2016 02:48:46 -0400 Received: by mail-qt0-f176.google.com with SMTP id f6so34088947qtd.2 for ; Wed, 12 Oct 2016 23:47:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zHJnrvh4vTSUgcS9mUxXqe9h81l/ujPLZ4enaEqeK3E=; b=hZOE/SzBZYwQIsY+J6bKRXR7ZszUKkvpW50ItYO7IAxKKYwxOzCyu5AJo4sBu12Fn/ CjTNA2lypa32bhU0AiUABHPfP4hghyue92IumMF2THvoVXfnYtsInoRKq0L629foo4SS dqQUXI2phLhDdZz7ReBdkppm1cEHAhSyf/vpw= 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=zHJnrvh4vTSUgcS9mUxXqe9h81l/ujPLZ4enaEqeK3E=; b=fXv4BA5N8LZdHyTPlh/WrpMdu4R6iqsB+097Tp4v3fdWXYyYBRrKDMwCQRTtWJxr5j cYKH+5lGRX9P5eMbuoWSuOGaTgPI+Y4wthfr3PYh/i5dcey94Hh90uR+LvuE4JdeGsVr TTM8m9zdJiPynZbwUQlAEt7ympnBrLaOXsAevZORDeMIOwNl+hVpoJeGVMrpf8UMSecT ZH+iSd4qE3Ao/cnD6JtdLAGCcpB15822RA8P29Yw4LKMrszBh1M8K/l+e8UHlxIUnqTh b+KMBKNw22pydJuNFVACMp0CIyA7RLowhooey2xWrd+kP3A3TmF+jyqWh0WVdRY0WPIS I7ng== X-Gm-Message-State: AA6/9Rn5iydLPTd+Mv1qeevyE8JJTAfmXbPy4flbsJs4H+Cz9neK7xF1216YZvV4JiAAsXMG X-Received: by 10.200.51.144 with SMTP id c16mr5232559qtb.74.1476340779385; Wed, 12 Oct 2016 23:39:39 -0700 (PDT) Received: from android.dhcp.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id y20sm4140321qta.7.2016.10.12.23.39.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Oct 2016 23:39:38 -0700 (PDT) From: Jitendra Bhivare To: cleech@redhat.com, lduncan@suse.com Cc: linux-scsi@vger.kernel.org, Jitendra Bhivare Subject: [PATCH 1/2] libiscsi: Fix locking in __iscsi_conn_send_pdu Date: Thu, 13 Oct 2016 12:08:48 +0530 Message-Id: <1476340729-8569-2-git-send-email-jitendra.bhivare@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476340729-8569-1-git-send-email-jitendra.bhivare@broadcom.com> References: <1476340729-8569-1-git-send-email-jitendra.bhivare@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The code at free_task label in __iscsi_conn_send_pdu can get executed from blk_timeout_work which takes queue_lock using spin_lock_irq. back_lock taken with spin_unlock_bh will cause WARN_ON_ONCE. The code gets executed either with bottom half or IRQ disabled hence using spin_lock/spin_unlock for back_lock is safe. Signed-off-by: Jitendra Bhivare Reviewed-by: Hannes Reinecke Reviewed-by: Chris Leech Reviewed-by: Lee Duncan --- drivers/scsi/libiscsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index c051694..f9b6fba 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -791,9 +791,9 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, free_task: /* regular RX path uses back_lock */ - spin_lock_bh(&session->back_lock); + spin_lock(&session->back_lock); __iscsi_put_task(task); - spin_unlock_bh(&session->back_lock); + spin_unlock(&session->back_lock); return NULL; }