Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754140AbdCHQ32 (ORCPT ); Wed, 8 Mar 2017 11:29:28 -0500 Received: from mail-qk0-f178.google.com ([209.85.220.178]:33133 "EHLO mail-qk0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751906AbdCHQVI (ORCPT ); Wed, 8 Mar 2017 11:21:08 -0500 From: Kashyap Desai References: <20170308151113.GB27450@infradead.org> <20170308160633.GA25913@infradead.org> In-Reply-To: <20170308160633.GA25913@infradead.org> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHqyi2z261OWXWykCAwms8keM8sWgI2aaMXAa7Vrb0CF5pQ3qEq0cTQ Date: Wed, 8 Mar 2017 21:41:48 +0530 Message-ID: Subject: RE: out of range LBA using sg_raw To: Christoph Hellwig Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1549 Lines: 38 > -----Original Message----- > From: Christoph Hellwig [mailto:hch@infradead.org] > Sent: Wednesday, March 08, 2017 9:37 PM > To: Kashyap Desai > Cc: Christoph Hellwig; linux-kernel@vger.kernel.org; linux- > scsi@vger.kernel.org > Subject: Re: out of range LBA using sg_raw > > On Wed, Mar 08, 2017 at 09:29:28PM +0530, Kashyap Desai wrote: > > Thanks Chris. It is understood to have sanity in driver, but how > > critical such checks where SG_IO type interface send pass-through request. > ? > > Are you suggesting as good to have sanity or very important as there > > may be a real-time exposure other than SG_IO interface ? I am confused > > over must or good to have check. > > Also one more fault I can generate using below sg_raw command - > > SCSI _devices_ need to sanity check any input and fail commands instead of > crashing or causing other problems. Normal SCSI HBA drivers don't need to > do that as they don't interpret CDBs. Megaraid (and a few other raid drivers) > are special in that they take on part of the device functionality and do > interpret CDBs sometimes. In that case you'll need to do all that sanity > checking and generate proper errors. > > It would be nice to have come common helpers for this shared between > everyone interpreting SCSI CBD (e.g. the SCSI target code, the NVMe SCSI > emulation and the various RAID drivers). Thanks Chris. I will continue on this and will come back with changes. Let me check with Broadcom internally and figure out all possible scenarios for megaraid_sas. Thanks, Kashyap