Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1830740imm; Mon, 3 Sep 2018 10:32:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaC4IjeUF5md6nOBZRivXdDFda7jj6lCtHAd3EMSPrLL+ggzZgT8PPG9wcDBkoS62KDKJTy X-Received: by 2002:a62:9e08:: with SMTP id s8-v6mr30860882pfd.23.1535995943268; Mon, 03 Sep 2018 10:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995943; cv=none; d=google.com; s=arc-20160816; b=K9piFpgvzY0SSG5J0Oeo3tEqa0/CSvm0/puRK2dr29xVOy8GwDlupqmInKkJbHsq/q Mqnx7G+faE+hCYOz7Di8Gw+vBz1cbLLt/Vsw8ZCp6SmdN/QHOkGzZksH2LyZcPK1FBZO yl/QalPOLWoeHbWkYr/pAxtoUGRiJ16vnhvn6VQomr31esDR7e5Gh9KbGiB5dcALxVAQ hddEBynW0JCHMDVZh/uE5re/ubNKGg9Bjr12nM0nJ9IfqF+jxWbKB8HpG0w6KNU+bx5c ytfSG4vDnuIc61TL4ykZKQvd5Z+JQHf342ZYXtqwyjtU9LaOoTtZ2PS5W2TzVM+xqhiy zARw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=t3Rw8DAljYy2NyR8Hoz5Fx97lZT7zNQ52TvzEzg71WM=; b=Ti5dIVXwd1PCm0EOH5BISEvMtqVk4iNejY7jNdARhHIGFS4Qad+UPXpP09/Lmn5fkN rabTPd+2GH1Dl/hjvasTESXzvpovWlhvMV4zmI8pEKVvnI6ugtzbVkMr61b4BzD70UOT /Yi7GbRGaB4W2E9QNsigJB6dzJenFhosyz8Pen3e69/Y8VkzZPQUFoKZ8REUg/l0dTh2 beTpzr9d89qEif65meAp8VuVsqWNVpjsrw74o4P993klUH91V43oFbKnEKq31oXwkITc u5GRZmRlm/fGTHQ0SRLNLoJdyvnme8bL4/GQcgigz4ptPyR6DqWaSlMm1pEoCsEoXbn4 iW6A== ARC-Authentication-Results: i=1; mx.google.com; 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 b19-v6si20740602pfb.89.2018.09.03.10.32.07; Mon, 03 Sep 2018 10:32:23 -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; 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 S1730958AbeICVsS (ORCPT + 99 others); Mon, 3 Sep 2018 17:48:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46002 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730922AbeICVsQ (ORCPT ); Mon, 3 Sep 2018 17:48:16 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1A44AD20; Mon, 3 Sep 2018 17:19:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Thumshirn , Hannes Reinecke , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 078/165] scsi: fcoe: fix use-after-free in fcoe_ctlr_els_send Date: Mon, 3 Sep 2018 18:56:04 +0200 Message-Id: <20180903165659.002775025@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johannes Thumshirn [ Upstream commit 2d7d4fd35e6e15b47c13c70368da83add19f01e7 ] KASAN reports a use-after-free in fcoe_ctlr_els_send() when we're sending a LOGO and have FIP debugging enabled. This is because we're first freeing the skb and then printing the frame's DID. But the DID is a member of the FC frame header which in turn is the skb's payload. Exchange the debug print and kfree_skb() calls so we're not touching the freed data. Signed-off-by: Johannes Thumshirn Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/fcoe/fcoe_ctlr.c +++ b/drivers/scsi/fcoe/fcoe_ctlr.c @@ -799,9 +799,9 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr fip->send(fip, skb); return -EINPROGRESS; drop: - kfree_skb(skb); LIBFCOE_FIP_DBG(fip, "drop els_send op %u d_id %x\n", op, ntoh24(fh->fh_d_id)); + kfree_skb(skb); return -EINVAL; } EXPORT_SYMBOL(fcoe_ctlr_els_send);