Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853AbdITXB5 (ORCPT ); Wed, 20 Sep 2017 19:01:57 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:41682 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751584AbdITXB4 (ORCPT ); Wed, 20 Sep 2017 19:01:56 -0400 Date: Wed, 20 Sep 2017 16:01:55 -0700 (PDT) Message-Id: <20170920.160155.1154864064570909831.davem@davemloft.net> To: mengxu.gatech@gmail.com Cc: isdn@linux-pingi.de, johannes.berg@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, meng.xu@gatech.edu, sanidhya@gatech.edu, taesoo@gatech.edu Subject: Re: [PATCH] isdn/i4l: fetch the ppp_write buffer in one shot From: David Miller In-Reply-To: <1505872195-46627-1-git-send-email-mengxu.gatech@gmail.com> References: <1505872195-46627-1-git-send-email-mengxu.gatech@gmail.com> X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 20 Sep 2017 16:01:56 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 989 Lines: 21 From: Meng Xu Date: Tue, 19 Sep 2017 21:49:55 -0400 > In isdn_ppp_write(), the header (i.e., protobuf) of the buffer is > fetched twice from userspace. The first fetch is used to peek at the > protocol of the message and reset the huptimer if necessary; while the > second fetch copies in the whole buffer. However, given that buf resides > in userspace memory, a user process can race to change its memory content > across fetches. By doing so, we can either avoid resetting the huptimer > for any type of packets (by first setting proto to PPP_LCP and later > change to the actual type) or force resetting the huptimer for LCP > packets. > > This patch changes this double-fetch behavior into two single fetches > decided by condition (lp->isdn_device < 0 || lp->isdn_channel <0). > A more detailed discussion can be found at > https://marc.info/?l=linux-kernel&m=150586376926123&w=2 > > Signed-off-by: Meng Xu Applied, thank you.