Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2620674ybi; Thu, 18 Jul 2019 11:19:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPXxIosRWYdVzhSwwO/T0n5jyitaCD06lRn0n+BCtOYlYnt33NyKlahAzWdGI0L/fifT6Q X-Received: by 2002:a63:2cd5:: with SMTP id s204mr35950259pgs.95.1563473961345; Thu, 18 Jul 2019 11:19:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563473961; cv=none; d=google.com; s=arc-20160816; b=N34IbirdU0j50NqwwpigPSYOldI2IA2xXVTVOy2/qbCbI6hR8wDaHwE096+CyxrlEt WqXI4IftvrdrLfjSX13OSLEWwK0vvato9G/IcyCFxvW2n/qwwoDmsHBcv1KktYBdzZKX hMydbdiibyZeeH7YYgZ1ePgjWfM1MTYWWQzcxgfyeRvm8Xg7mPtHd+k6uokwiJbcvwJj MFLtN9FiNhfJvYEuIkm83DK5C6BHw58+ASuxdA7wdLhXQlTqGI6izU060LSPX2uxAFSd BPykNhPAOWZMctANQMJcNhsAVaKIHVpDljAmMEvYuIpG+OOWZK8k5x/bGS2PnejhE2ps MALA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=R2ZKKillOT2dQFQS3T7ybfIBaXwl3OzT7BgL8DD2Jho=; b=u49vHnXeX4OumFN8pyBE+Quhjmg9fIqZBc8v/U8gdxjid1lNVvuUnjz/LjArSydDSW mKTpNIyph9sQvQ5mM2aCnm36jHqzo+WoquQ7Vo/rZ0sdSM3GczkC4GrR6enKwciNC4VQ hL4zJ5c3a64w56jeabFbi9MJT1qf66ElEzgC8kVRLlg7uP1gr8OnNUO0BV31AqXCB0aK PUX/n7o7hNPkuu0/EQT9b6SdhWetzo78cTvxPykajbNPIOjVJEkOocduiTZQnDvERGH0 RhsJbZvQFtAMGvzzG8gl1iUQHOPjHrUhQnT9025M4cw1J6PRoyE+rr/HlICuHGlTp3wD c2tg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si25156502ply.15.2019.07.18.11.19.05; Thu, 18 Jul 2019 11:19:21 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391183AbfGRSSa (ORCPT + 99 others); Thu, 18 Jul 2019 14:18:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42268 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391148AbfGRSS0 (ORCPT ); Thu, 18 Jul 2019 14:18:26 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 30D0C317916D; Thu, 18 Jul 2019 18:18:26 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-160.bos.redhat.com [10.18.17.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2DA41001B35; Thu, 18 Jul 2019 18:18:25 +0000 (UTC) Subject: Re: [PATCH] scsi: ses: Fix out-of-bounds memory access in ses_enclosure_data_process() To: James Bottomley , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190501180535.26718-1-longman@redhat.com> <1fd39969-4413-2f11-86b2-729787680efa@redhat.com> <1558363938.3742.1.camel@linux.ibm.com> From: Waiman Long Organization: Red Hat Message-ID: <729b0751-01a6-7c0b-ce0d-f19807b59dee@redhat.com> Date: Thu, 18 Jul 2019 14:18:25 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <1558363938.3742.1.camel@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 18 Jul 2019 18:18:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/20/19 10:52 AM, James Bottomley wrote: > On Mon, 2019-05-20 at 10:41 -0400, Waiman Long wrote: > [...] >>> --- a/drivers/scsi/ses.c >>> +++ b/drivers/scsi/ses.c >>> @@ -605,9 +605,14 @@ static void ses_enclosure_data_process(struct >>> enclosure_device *edev, >>> /* these elements are optional */ >>> type_ptr[0] == >>> ENCLOSURE_COMPONENT_SCSI_TARGET_PORT || >>> type_ptr[0] == >>> ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT || >>> - type_ptr[0] == >>> ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS)) >>> + type_ptr[0] == >>> ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS)) { >>> addl_desc_ptr += addl_desc_ptr[1] >>> + 2; >>> >>> + /* Ensure no out-of-bounds memory >>> access */ >>> + if (addl_desc_ptr >= ses_dev- >>>> page10 + >>> + ses_dev- >>>> page10_len) >>> + addl_desc_ptr = NULL; >>> + } >>> } >>> } >>> kfree(buf); >> Ping! Any comment on this patch. > The update looks fine to me: > > Reviewed-by: James E.J. Bottomley > > It might also be interesting to find out how the proliant is > structuring this descriptor array to precipitate the out of bounds: Is > it just an off by one or something more serious? > > James > Is someone going to merge this patch in the current cycle? Thanks, Longman