Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753536AbcKHQDG (ORCPT ); Tue, 8 Nov 2016 11:03:06 -0500 Received: from b.ns.miles-group.at ([95.130.255.144]:44723 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752269AbcKHQDE (ORCPT ); Tue, 8 Nov 2016 11:03:04 -0500 Subject: Re: [PATCH] drbd: Fix kernel_sendmsg() usage To: Christoph Hellwig References: <1478601789-15060-1-git-send-email-richard@nod.at> <20161108154924.GA19063@infradead.org> 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 From: Richard Weinberger Message-ID: <748300d8-2a47-b273-5458-014dd3e3d6fc@nod.at> Date: Tue, 8 Nov 2016 17:02:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <20161108154924.GA19063@infradead.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 867 Lines: 22 Christoph, On 08.11.2016 16:49, Christoph Hellwig wrote: > 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 Yes, I talked already with Al about this. He suggested to fix the size parameter first such that back-porting to -stable is easy. Thanks, //richard