From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751495AbdBSRZx (ORCPT ); Sun, 19 Feb 2017 12:25:53 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:33532 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750836AbdBSRZw (ORCPT ); Sun, 19 Feb 2017 12:25:52 -0500 Date: Sun, 19 Feb 2017 09:25:41 -0800 From: Christoph Hellwig To: Al Viro Cc: James Bottomley , Dmitry Vyukov , Johannes Thumshirn , "Martin K. Petersen" , linux-scsi , LKML , syzkaller , Hannes Reinecke , Linus Torvalds Subject: Re: scsi: BUG in scsi_init_io Message-ID: <20170219172541.GA29867@infradead.org> References: <20170131092048.GB3687@linux-x5ow.site> <1485877311.3199.4.camel@linux.vnet.ibm.com> <20170219071522.GI29622@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170219071522.GI29622@ZenIV.linux.org.uk> User-Agent: Mutt/1.7.1 (2016-10-04) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 19, 2017 at 07:15:27AM +0000, Al Viro wrote: > The root cause is unfixable without access to TARDIS and dose of > antipsychotics sufficient to prevent /dev/sg API creation. > > What happens is that write to /dev/sg is given a request with non-zero > ->iovec_count combined with zero ->dxfer_len. Or with ->dxferp pointing > to an array full of empty iovecs. > > AFAICS, the minimal fix would be something like this: > > YAMissingSanityCheck in /dev/sg > > write permission to /dev/sg shouldn't be equivalent to the ability to trigger > BUG_ON() while holding spinlocks... Looks fine to me: Reviewed-by: Christoph Hellwig The other thing we really need to consider is to finally merge the SG_IO implementations for /dev/sg with the common block layer one.