Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7151095ybi; Mon, 8 Jul 2019 15:40:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFIVdUF+yUxYfcwjmF8wJnXslaRN+sUjbrE7ihbH3vEOgfAfVFhrur/95hOVZ0RcRR3cxi X-Received: by 2002:a17:90a:d814:: with SMTP id a20mr28776803pjv.48.1562625631380; Mon, 08 Jul 2019 15:40:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625631; cv=none; d=google.com; s=arc-20160816; b=ETvQPMZTH7YEJ/Cxg+DjA4/U+/uOZcnD5wAtszUokCAg5VotGcnt/b4G9x5cz5lA6j gUK1HrIivwG0PSB9yZlCtPZ4hH2N2MixQuYPLaPIrH8LV57ce97PEUAKvMqZilOKF9J0 K9DZgd3KLglGcWA5XYcVvoIVxaAUjW37rK19pu+KgvD8VUps3lGwn58kAJi0SsbPTEkC 5NLDTXCejaWDMUfs+9+msJiF6FUSFDkk87uet0Zq6D0oWNYUCFVLXPlCkKrr8PIu6Yso SnwdlBUr1yEOr1C02wy7fvBJP4sOAfft2zeIfl7H1mFF/RR8r5DU8wNLSBuaw/r7Ld/m vTTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rz+dp5JcAMjDZXqKsJCZD4ciPZp7eTIlwfvB0q+umKk=; b=ygGeEGepHt3QRexrvpKGN8VO2Yr5zEGI8Jh4ZG/yXBY8bvczki83qWgEKSBMRP/dIx sWaUyr+w40cSSU4gYifBbY4Ye1qywKMA/j4xOO/7k2/WgB7RwfgFVlwVa7AveriSPLiw klf2EXQFrR0ZxWHWb50WW9T5URmOjm1/nuUD/8tO83dJwJ81z38Y9RA9hnjDU2xhJR8A QpWAGb+vzWL9qhPiqLfF+PDkFuUYp9XTqB9dBW7VbdEoVW72qYbwXh8no8QhiRDAmVwQ WEgoAz1ip3USvbyHnfrmDZMP4WjyNmQbBFhW0x+i3DvZLM7hq9Y1G6pVJhGRu3ANn3Nv ip6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QZlDD6Vp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k11si20121405pgb.427.2019.07.08.15.40.16; Mon, 08 Jul 2019 15:40:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QZlDD6Vp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390794AbfGHPje (ORCPT + 99 others); Mon, 8 Jul 2019 11:39:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:58228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389469AbfGHP30 (ORCPT ); Mon, 8 Jul 2019 11:29:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1534A21537; Mon, 8 Jul 2019 15:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599765; bh=qZLBh1sHjxWGHiD87H4Vw/gWJ+gUf8HfaEv+Mc9nFsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QZlDD6VpVrvM44LD8Aij9s2QR7yUYeuCUBDBAk8xW8n0hyerUt8Nf/pG0fWr7xAwU dqmvumuybbQv+GXqjknq4ggVREomCMcEpJcPUmqeKYL++SqBuoxQQE1vrXA9aLPCGr xeb/x1Re+RnUj41D4kIzBvr6YNKQDKnynMQW++40= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Mike Christie , Xiubo Li , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 70/90] scsi: tcmu: fix use after free Date: Mon, 8 Jul 2019 17:13:37 +0200 Message-Id: <20190708150525.874122459@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150521.829733162@linuxfoundation.org> References: <20190708150521.829733162@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 40d883b091758472c79b81fa1c0e0347e24a9cff ] Fixes: a94a2572b977 ("scsi: tcmu: avoid cmd/qfull timers updated whenever a new cmd comes") Reported-by: Dan Carpenter Cc: Mike Christie Signed-off-by: Xiubo Li Reviewed-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/target/target_core_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index ac7620120491..c46efa47d68a 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -1317,12 +1317,13 @@ static int tcmu_check_expired_cmd(int id, void *p, void *data) * target_complete_cmd will translate this to LUN COMM FAILURE */ scsi_status = SAM_STAT_CHECK_CONDITION; + list_del_init(&cmd->queue_entry); } else { + list_del_init(&cmd->queue_entry); idr_remove(&udev->commands, id); tcmu_free_cmd(cmd); scsi_status = SAM_STAT_TASK_SET_FULL; } - list_del_init(&cmd->queue_entry); pr_debug("Timing out cmd %u on dev %s that is %s.\n", id, udev->name, is_running ? "inflight" : "queued"); -- 2.20.1