Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752601AbcKHPtf (ORCPT ); Tue, 8 Nov 2016 10:49:35 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:52496 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750905AbcKHPte (ORCPT ); Tue, 8 Nov 2016 10:49:34 -0500 Date: Tue, 8 Nov 2016 07:49:24 -0800 From: Christoph Hellwig To: Richard Weinberger Cc: drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org, lars.ellenberg@linbit.com, philipp.reisner@linbit.com, stable@vger.kernel.org, viro@zeniv.linux.org.uk, christoph.lechleitner@iteg.at, wolfgang.glas@iteg.at Subject: Re: [PATCH] drbd: Fix kernel_sendmsg() usage Message-ID: <20161108154924.GA19063@infradead.org> References: <1478601789-15060-1-git-send-email-richard@nod.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1478601789-15060-1-git-send-email-richard@nod.at> User-Agent: Mutt/1.6.1 (2016-04-27) 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 Content-Length: 641 Lines: 13 On Tue, Nov 08, 2016 at 11:43:09AM +0100, Richard Weinberger wrote: > Don't pass a size larger than iov_len to kernel_sendmsg(). > Otherwise it will cause a NULL pointer deref when kernel_sendmsg() > returns with rv < size. > > Although the issue exists since day 0, only on non-ancient kernels > that contain change 57be5bdad759 ("ip: convert tcp_sendmsg() to iov_iter > primitives") it seems to trigger [0][1][2][3][4]. The real fix here is to convert it to the right primitive, e.g. take Al's patch from here: https://git.kernel.org/cgit/linux/kernel/git/viro/vfs.git/commit/?h=work.sendmsg&id=7a4992299554a9e1ed3c4540bcfa9e40aa9a6376