From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030347AbcBQQoN (ORCPT ); Wed, 17 Feb 2016 11:44:13 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:34456 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751388AbcBQQoL (ORCPT ); Wed, 17 Feb 2016 11:44:11 -0500 Date: Wed, 17 Feb 2016 16:44:07 +0000 From: Al Viro To: Joe Korty Cc: "David S. Miller" , Linux Kernel Mailing List Subject: Re: [PATCH] Fix kfree bug in sendmsg and recvmsg Message-ID: <20160217164407.GL17997@ZenIV.linux.org.uk> References: <20160217163805.GA15781@zipoli.ccur.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160217163805.GA15781@zipoli.ccur.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 17, 2016 at 11:38:05AM -0500, Joe Korty wrote: > Fix kfree bug in recvmsg and sendmsg. > > We cannot kfree(iov) when iov points to an array on the > stack, as that has the potential of corrupting memory. > > So re-introduce the if-stmt that used to protect kfree > from this condition, code that was removed as part of > a larger set of changes made by git commit da184284. NAK. You are misreading import_iovec(): *iov = p == *iov ? NULL : p; in the end will have iov replaced with NULL if we ended up using what it originally pointed to.