From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values Date: Fri, 28 Jun 2013 04:09:59 +0100 Message-ID: <20130628030959.GD4165@ZenIV.linux.org.uk> References: <1372386158-11076-1-git-send-email-ryao@gentoo.org> <1372386158-11076-3-git-send-email-ryao@gentoo.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, kernel@gentoo.org, zfs-devel@zfsonlinux.org To: Richard Yao Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:54493 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753743Ab3F1DKA (ORCPT ); Thu, 27 Jun 2013 23:10:00 -0400 Content-Disposition: inline In-Reply-To: <1372386158-11076-3-git-send-email-ryao@gentoo.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Jun 27, 2013 at 10:22:38PM -0400, Richard Yao wrote: > generic_file_llseek_size() handles whence values in a switch statement, > but it lacks cases for both SEEK_SET and invalid values. This causes it > to treat all invalid whence values as SEEK_SET, which is wrong. > > We fix that by adding a case for SEEK_SET and a default case. NAK. Validation of whence is done before we even get to vfs_llseek(). Leaving it to ->llseek() instances would've been an insanity.