From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755988Ab1G1U2h (ORCPT ); Thu, 28 Jul 2011 16:28:37 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:54243 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755829Ab1G1U2e (ORCPT ); Thu, 28 Jul 2011 16:28:34 -0400 Subject: Re: [PATCH 12/13] iscsi-target: Add misc utility logic From: "Nicholas A. Bellinger" To: Fubo Chen Cc: target-devel , linux-scsi , linux-kernel , Christoph Hellwig , Andy Grover In-Reply-To: References: <1311410747-29947-1-git-send-email-nab@linux-iscsi.org> <1311410747-29947-13-git-send-email-nab@linux-iscsi.org> Content-Type: text/plain Date: Thu, 28 Jul 2011 13:19:13 -0700 Message-Id: <1311884353.6931.206.camel@haakon2.linux-iscsi.org> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2011-07-28 at 13:30 +0200, Fubo Chen wrote: > On Sat, Jul 23, 2011 at 10:45 AM, Nicholas A. Bellinger > wrote: > > +static int iscsit_do_rx_data( > > + struct iscsi_conn *conn, > > + struct iscsi_data_count *count) > > +{ > > + int data = count->data_length, rx_loop = 0, total_rx = 0, iov_len; > > + u32 rx_marker_val[count->ss_marker_count], rx_marker_iov = 0; > > + struct kvec iov[count->ss_iov_count], *iov_p; > > How big can count->ss_iov_count be ? Can this make a stack overflow ? > This is set to zero when OFMarker and IFMarker are explictly disabled (the default), which is the case for the vast majority of initiators. When this is enabled, the smallest this value for OFMarkInt and IFMarkInt can be is 512 bytes, which on 64-bit with a 131072 MaxRecvDataSegmentLength would mean 3k of stack usage for iov[] above.. In the end it might may more sense to just remove the OFMarker and IFMarker alltogether code than to worry about dynamic allocation here. --nab