From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Martin K. Petersen" Subject: Re: [PATCH] sg: protect against races between mmap() and SG_SET_RESERVED_SIZE Date: Tue, 22 Aug 2017 22:21:06 -0400 Message-ID: References: <20170816054108.119890-1-toddpoynor@google.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <20170816054108.119890-1-toddpoynor@google.com> (Todd Poynor's message of "Tue, 15 Aug 2017 22:41:08 -0700") Sender: linux-kernel-owner@vger.kernel.org To: Todd Poynor Cc: Doug Gilbert , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Hannes Reinecke List-Id: linux-scsi@vger.kernel.org Todd, > Take f_mutex around mmap() processing to protect against races with > the SG_SET_RESERVED_SIZE ioctl. Ensure the reserve buffer length > remains consistent during the mapping operation, and set the > "mmap called" flag to prevent further changes to the reserved buffer > size as an atomic operation with the mapping. Applied to 4.14/scsi-queue (with a slight whitespace fix). Thanks! -- Martin K. Petersen Oracle Linux Engineering