Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp484189imm; Tue, 31 Jul 2018 23:31:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfaWAO1+zPMKHRo12KMfplY/vOcOvV/BqqU7/PScUBxNKZY+TEAL0Rz1bTPtFxWwtqM2hg1 X-Received: by 2002:a17:902:e005:: with SMTP id ca5-v6mr23448922plb.224.1533105096519; Tue, 31 Jul 2018 23:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533105096; cv=none; d=google.com; s=arc-20160816; b=INqYqb/QR520/OHPRZZ9Ecdex0xVeP6Ms9Jeie4Vs8zf7wWrHth/cfEF4pdzUGpj+o madO0pS4X1XCn+eFNKH1zd9MgCQ4+xIoG6k3EwwNox9OeKFKjJjswMVxfspAgEC2hVwb jaqvyVnU1eXKvcrVO7uJYN6riKBDH3PeHdl2+WfRrGVSlEZacDmn3S4XaTHPnpPXohqJ VwIUYvVTc95i8fbDWPqta9jxPrkF3zKux1h7PmPeM2rS5pKsHadoQa3W+hwRnSLrHfi1 z6t1KIKxZD59nGzHEUXeTYnqZkzwG70SpFQbTB1npqdMsm17xR++XTSrzj426pyojj0A EpQg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=bPWyL3/2I3GOFZM0dQxG8+mPv7SxfRoADvt2xkFdMRA=; b=xlYLF4R19TkowzPCRpOVYdfPg02Fyde21UZksy+fkYInUnJbyUyqnnaFZVnL0CTcgi ksElJ50QLDqo7xu1943TEBmvnBXeOXeaLYUBcc8+cgUiTWvllSg4RPzryNIrZdVOtefm uvdOgn/RbqA5HDr5asvz0MQ7lSBmBspdNBoY94DhIla31qyUvFl8BGuK4zR+O4Dxejvy SXT923AiIceKDLkQwY2Gc338AaQbAxvk5AVUuqesZD6z/pvJOinm88wqdOsJXfZZQgz0 eezeIe8PHZZUwd9nxhFQUMwuyHkZ9qBq28y29IfxL1sNM23Z/DvfhpYTynjBMle0LpvR IdaA== 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 b22-v6si4806560pls.127.2018.07.31.23.31.21; Tue, 31 Jul 2018 23:31:36 -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 S2387476AbeHAIOT (ORCPT + 99 others); Wed, 1 Aug 2018 04:14:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:51030 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387419AbeHAIOT (ORCPT ); Wed, 1 Aug 2018 04:14:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4EF48AEB9; Wed, 1 Aug 2018 06:30:14 +0000 (UTC) Subject: Re: [PATCH 1/3] fcoe: fix use-after-free in fcoe_ctlr_els_send To: Johannes Thumshirn , "Martin K . Petersen" Cc: Linux Kernel Mailinglist , Linux SCSI Mailinglist , ard References: <20180731134603.20089-1-jthumshirn@suse.de> <20180731134603.20089-2-jthumshirn@suse.de> From: Hannes Reinecke Message-ID: Date: Wed, 1 Aug 2018 08:30:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180731134603.20089-2-jthumshirn@suse.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/31/2018 03:46 PM, Johannes Thumshirn wrote: > 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 > --- > drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c > index ea23c8dffc25..ceb35ebbeb8f 100644 > --- 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, struct fc_lport *lport, > 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); > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)