Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp14380490ybl; Mon, 30 Dec 2019 09:05:01 -0800 (PST) X-Google-Smtp-Source: APXvYqz8Qg0eG+q75aNcM1JD53lPAhmiXiu+sc0BxVfoSx6zptMH0c2RwSM0uhPope/c8LMTRpiX X-Received: by 2002:a05:6830:4a7:: with SMTP id l7mr69738171otd.372.1577725501107; Mon, 30 Dec 2019 09:05:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577725501; cv=none; d=google.com; s=arc-20160816; b=CWVKwv+xlcEj7ChjrLUvpPQU8geEBrqRpoMuh8LVJcibQfkKmPg5hNqHb7PIe20I8B 0znO9hSFovk9o7o2WEbol35lwHOYmOWXSk/WqHQ1yYXIfQxYwLu3ZLkHE5Zeal0y5YRn lgc/lxIcwOJH54Unt6QG+1sRMyedgTiQZ4zG5ociEK1fIzwHW/Z95TiThVIuBOIWT6Rn NMlKjJ2V52hjw47ixlYOHzQOvPAIrsWosoX+6SxC5qWO2HCJiwW7RgjwdNdGlS9tXRhr /6gMwCIAOhlFTVZIk/Hqjiw4QXNVPfr5WS7H7yfbbjG+xpvbnMUxRGUzg05wEaJKW90i b4vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Rka3ilO99bAcq48TNL+hlG2WYcFVK54JT4LskhtH/CE=; b=PmbiNmm+z+VqVr2K24dmnISmB2LxJ0pTqz/s/toZbCm+er+Yb/r3Bxi9kJXxAOoJ/S 9wEheiPfOdcuJzhAJf+Y0k9xL33zxm8lrq1x/9+55ugNoCY0MgpkSQcg26Sv1ifqTxfT nuJURLkp4+ea46C+RVxQZOoL2QqNClymuyFeV78r0I1JcRkT1rS/XPk0DHVMPu+ydW8+ GGZzChnEPASSpDYVGBYvLCiGtur7QBm6PjNHeJqUu/V1tUGnat32hgEBBjgJF6B/6na+ fn35VTKL+CPndd7q5vPEJZ94ZA8RSF9aGEDkTsM9bJ7KjzB5ayJv3ImOaMKM7lPSjz9P LLQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=IW06kpVx; 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 p21si14574272otk.162.2019.12.30.09.04.48; Mon, 30 Dec 2019 09:05:01 -0800 (PST) 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=fail header.i=@gmail.com header.s=20161025 header.b=IW06kpVx; 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 S1727275AbfL3RDo (ORCPT + 99 others); Mon, 30 Dec 2019 12:03:44 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:37526 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727123AbfL3RDn (ORCPT ); Mon, 30 Dec 2019 12:03:43 -0500 Received: by mail-qk1-f194.google.com with SMTP id 21so26700763qky.4 for ; Mon, 30 Dec 2019 09:03:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Rka3ilO99bAcq48TNL+hlG2WYcFVK54JT4LskhtH/CE=; b=IW06kpVxlvi/ChzeLckluKNsjgCEzeO+qgp6fUtwrfWPfH28vIGifK1gM26HKzHH5w zOAkgqwTTvMo4/lDbW/j6esKSNbbYkpLTnT5DnybCbfhCD1GRQ9fESAAAqLkzcb3vxHb dRvY7Lf3Fsas2ruCrepZ0zYnZ7lQl2XyTkWs1YEWF71YPet7vb3eEDvG5exd0W9IgEGc Qvub15S+BpYk7M5xbA1+N0+XFvrPJegjqbGOLNIQ2H2g/YBkanRM+5kHF2G7qC5HvmbQ ogUuUcl2nmqiug6EqHYswAXv1E6fSM671BbNRGvkzeRj/PPXBrissuJTxoU+iibrxQ+s Om/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=Rka3ilO99bAcq48TNL+hlG2WYcFVK54JT4LskhtH/CE=; b=Tbi6G4YtdINBjBYJvZUFYXUkF+jimoKZF/dj18nEWo3zRbwl+xHEA+glo0Ky6ll1df iF/SGLyhsQI5SlYmPJr5Y0Fg1q+gWCD3eJ8lfODcrnJArFBwAnsfSZSFczjnlGVIkO+o LlWQkUMN1t7Uwe5egZcut2Q+CFCsVYvzBnkOKsjMzcCrVdOeJFXdAZCDNJaYJtL1f0k+ 5KSBlWXT5gpf3yI5qPf+VNeFAvE8x/pPjYJb8N9YnTHJiaD3xXIkqrkVhrBF4eD048WI u4LRjOlSMuw2KrCiP950P8irSbRd/ulaDeKv4aEduzFhlCq90tdQinIpaO8TCq0AkCDg TUlg== X-Gm-Message-State: APjAAAUYpWNPhA8SL3dUD4vZBF/VYlxDo3+Umex9qr1Bg6l4wgkKZaEK +dKmqouB6+uRmCCvbP4OmMk= X-Received: by 2002:ae9:eb13:: with SMTP id b19mr54487398qkg.6.1577725422980; Mon, 30 Dec 2019 09:03:42 -0800 (PST) Received: from localhost.localdomain (209-6-36-129.s6527.c3-0.smr-cbr2.sbo-smr.ma.cable.rcncustomer.com. [209.6.36.129]) by smtp.gmail.com with ESMTPSA id w20sm14049424qtj.4.2019.12.30.09.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2019 09:03:42 -0800 (PST) Date: Mon, 30 Dec 2019 12:03:40 -0500 From: Konrad Rzeszutek Wilk To: Lubomir Rintel Cc: Konrad Rzeszutek Wilk , Peter Jones , linux-kernel@vger.kernel.org Subject: Re: [RESEND PATCH] iscsi_ibft: Don't limits Targets and NICs to two Message-ID: <20191230170340.GA23237@localhost.localdomain> References: <20191221070956.268321-1-lkundrak@v3.sk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191221070956.268321-1-lkundrak@v3.sk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 21, 2019 at 08:09:56AM +0100, Lubomir Rintel wrote: > According to iSCSI Boot Firmware Table Version 1.03 [1], the length of > the control table is ">= 18", where the optional expansion structure > pointer follow the mandatory ones. This allows for more than two NICs > and Targets. > > [1] ftp://ftp.software.ibm.com/systems/support/bladecenter/iscsi_boot_firmware_table_v1.03.pdf > > Let's enforce the minimum length of the control structure instead > instead of limiting it to the smallest allowed size. Hi! Do you have an example of such iBFT table? Thanks > > Signed-off-by: Lubomir Rintel > --- > drivers/firmware/iscsi_ibft.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c > index 7e12cbdf957cc..96758b71a8db8 100644 > --- a/drivers/firmware/iscsi_ibft.c > +++ b/drivers/firmware/iscsi_ibft.c > @@ -104,6 +104,7 @@ struct ibft_control { > u16 tgt0_off; > u16 nic1_off; > u16 tgt1_off; > + u16 expansion[0]; > } __attribute__((__packed__)); > > struct ibft_initiator { > @@ -235,7 +236,7 @@ static int ibft_verify_hdr(char *t, struct ibft_hdr *hdr, int id, int length) > "found %d instead!\n", t, id, hdr->id); > return -ENODEV; > } > - if (hdr->length != length) { > + if (length && hdr->length != length) { > printk(KERN_ERR "iBFT error: We expected the %s " \ > "field header.length to have %d but " \ > "found %d instead!\n", t, length, hdr->length); > @@ -749,16 +750,16 @@ static int __init ibft_register_kobjects(struct acpi_table_ibft *header) > control = (void *)header + sizeof(*header); > end = (void *)control + control->hdr.length; > eot_offset = (void *)header + header->header.length - (void *)control; > - rc = ibft_verify_hdr("control", (struct ibft_hdr *)control, id_control, > - sizeof(*control)); > + rc = ibft_verify_hdr("control", (struct ibft_hdr *)control, id_control, 0); > > /* iBFT table safety checking */ > rc |= ((control->hdr.index) ? -ENODEV : 0); > + rc |= ((control->hdr.length < sizeof(*control)) ? -ENODEV : 0); > if (rc) { > printk(KERN_ERR "iBFT error: Control header is invalid!\n"); > return rc; > } > - for (ptr = &control->initiator_off; ptr < end; ptr += sizeof(u16)) { > + for (ptr = &control->initiator_off; ptr + sizeof(u16) <= end; ptr += sizeof(u16)) { > offset = *(u16 *)ptr; > if (offset && offset < header->header.length && > offset < eot_offset) { > -- > 2.24.1 >