From patchwork Sun Mar 6 04:19:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 8512161 Return-Path: X-Original-To: patchwork-linux-scsi@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 0893D9F7CA for ; Sun, 6 Mar 2016 04:23:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F786201FA for ; Sun, 6 Mar 2016 04:23:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 437E72022D for ; Sun, 6 Mar 2016 04:23:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751162AbcCFEXi (ORCPT ); Sat, 5 Mar 2016 23:23:38 -0500 Received: from mail-ob0-f176.google.com ([209.85.214.176]:33890 "EHLO mail-ob0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751089AbcCFEXh (ORCPT ); Sat, 5 Mar 2016 23:23:37 -0500 Received: by mail-ob0-f176.google.com with SMTP id ts10so81512848obc.1 for ; Sat, 05 Mar 2016 20:23:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daterainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=Cb2CHgnycQ8LppSMTkhDOVe7S16lVtfXJFqfdr594Qk=; b=x07dg6R2JCN+KBa3dVtLE8Zt/IHpHFrnhyHZzfl0L6M0ZcehRlFklOTnbGptTLAyld i9Pqu0N0nIQGSrmeIa5tiWuIBmO4p+KTTpz621iI7J4YIMOM8F8TGYVLCCtfr/cEGS5w GSx1frZNkSizGjb0uUMWRo5ZqejsEg/J0clyaNufSIGNi7KgoA++bf+dvPnwSH0AOgS2 TFDWDXZNMJbWiASXRQMacks63RLvP07ZVKLczAQJdKPQQvnOqPMEjAEkK9G6RxuQqvJY W2rv5KHc3xwqEgRN8e/ke8xj2n1xgaySKzwoXD+W4rJSKZSDdLzJBhFg7RZAbTb3WjNf ABWQ== 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; bh=Cb2CHgnycQ8LppSMTkhDOVe7S16lVtfXJFqfdr594Qk=; b=A0JJlhJGjyYZaaRDBz+AqFuQcRwM+AXUTbyQqxy/ZNjGEqvFhLoaT7Hqrh9cH1jX9n Nsxxxzpz/kR7l16SLhQDzH81eNrTzHDFVcIC2CbnoG5xEtF7RXQkHU4YSkr4+ZroAz6h 116A0rwARLqrs9iiKVSZT/51oO3mP0aACKdZDJP7hh5fd04ioXnSF9m1y8ekUpLvQf7+ 32dn30hNAYPPcJzkjo/wBsXxjI1vVAb36kw4SUjNIIyuAiZ/tDx0/c/M/kF3bKnsUQD0 lmRUbWC62ikt7AEIV5tz3Nb0FIhPaDaio8cnofm00Er2+pscdvWZK8zbVmkJSXyLvaXN SMdw== X-Gm-Message-State: AD7BkJIIdRW/uVbq6UNJQVqcLjJK98qhkMTBk1d1qU73CwcN308DKHHs24HXxjC07azTmA== X-Received: by 10.182.252.68 with SMTP id zq4mr10525573obc.53.1457238216326; Sat, 05 Mar 2016 20:23:36 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id wh4sm7138292obc.10.2016.03.05.20.23.35 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 05 Mar 2016 20:23:35 -0800 (PST) From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , lkml , Nicholas Bellinger , Quinn Tran , Himanshu Madhani , Sagi Grimberg , Christoph Hellwig , Hannes Reinecke , Andy Grover , Mike Christie Subject: [PATCH] target: Drop incorrect ABORT_TASK put for completed commands Date: Sun, 6 Mar 2016 04:19:24 +0000 Message-Id: <1457237964-3536-1-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 From: Nicholas Bellinger This patch fixes a recent ABORT_TASK regression associated with commit febe562c, where a left-over target_put_sess_cmd() would still be called when __target_check_io_state() detected a command has already been completed, and explicit ABORT must be avoided. Note commit febe562c dropped the local kref_get_unless_zero() check in core_tmr_abort_task(), but did not drop this extra corresponding target_put_sess_cmd() in the failure path. So go ahead and drop this now bogus target_put_sess_cmd(), and avoid this potential use-after-free. Reported-by: Dan Lane Cc: Quinn Tran Cc: Himanshu Madhani Cc: Sagi Grimberg Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Andy Grover Cc: Mike Christie Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_tmr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 82a663b..4f229e7 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -177,7 +177,6 @@ void core_tmr_abort_task( if (!__target_check_io_state(se_cmd, se_sess, 0)) { spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); - target_put_sess_cmd(se_cmd); goto out; } list_del_init(&se_cmd->se_cmd_list);