From patchwork Mon Dec 12 11:31:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1479 Return-Path: Received: from nm8.bullet.mail.ukl.yahoo.com (nm8.bullet.mail.ukl.yahoo.com [217.146.182.249]) by open-mesh.org (Postfix) with SMTP id E20346007D1 for ; Mon, 12 Dec 2011 12:33:09 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.217] by nm8.bullet.mail.ukl.yahoo.com with NNFMP; 12 Dec 2011 11:33:09 -0000 Received: from [77.238.184.80] by tm10.bullet.mail.ukl.yahoo.com with NNFMP; 12 Dec 2011 11:33:09 -0000 Received: from [127.0.0.1] by smtp149.mail.ukl.yahoo.com with NNFMP; 12 Dec 2011 11:33:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1323689589; bh=9OkcTzjl+zDmfSb7vZqYwI86nEuX3HiCIs0WhdUBWKE=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=JP4fYRVF8yqCyhcAqD8FVW4LTlBGR9mN373nZoCYM9PL9IbtcNcYbjBw8kLxN+4bTJxC9cSrkmqyQGxH+xXrHMtbQ5NEn1FCfhcV55np50nEtejbzaCzgx4/xp5vc9pu1vQwlfxmd7IAq7icMI2BmcHjoyvcEXiLtFPn7P39538= X-Yahoo-Newman-Id: 736326.58523.bm@smtp149.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: MrzrjiEVM1kOoHOYUhzq6jSplOFOKaSyyUnr8br80AUriWg jBhIeYsIVM_Mde99N1NpVOvaVUtpCeh0kSmWr2X5DWYIQTfyNzebr1joJgcd nGlFgQUSOWZlVCY9jX6_H69A06e0cpP2C7qy.e1MPwDrvqw.EzlgJk4.MWuS oHcWwCLW5psZM7dHfmV69TPZLI88e0WazJ5vsjWdlFt_LRdOChGqSeieSENF RaSNjMqiYAehvtkxglVTPAMW4oRBRmwT3YkXXOAhH.Yo2nrSm3kEL2qk0wkF h9RlgVpuum9DVQTeqUaGxEtMBaLVzyMZYzvDKml5hpggC7CLcEUd8Y9x0Y66 OtBCISYDQi7m22d7NghUnH6iuP3EiHyqhbBFcAzr7OH4f9FI- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@210.177.7.38 with plain) by smtp149.mail.ukl.yahoo.com with SMTP; 12 Dec 2011 11:33:08 +0000 GMT From: Marek Lindner To: davem@davemloft.net Date: Mon, 12 Dec 2011 19:31:54 +0800 Message-Id: <1323689516-24427-11-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1323689516-24427-1-git-send-email-lindner_marek@yahoo.de> References: <1323689516-24427-1-git-send-email-lindner_marek@yahoo.de> Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 10/11] batman-adv: Directly check read of icmp packet in copy_from_user X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Dec 2011 11:33:10 -0000 From: Sven Eckelmann The access_ok read check can be directly done in copy_from_user since a failure of access_ok is handled the same way as an error in __copy_from_user. Signed-off-by: Sven Eckelmann Signed-off-by: Marek Lindner --- net/batman-adv/icmp_socket.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 88ab26f..3b04fff 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c @@ -187,12 +187,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, skb_reserve(skb, sizeof(struct ethhdr)); icmp_packet = (struct icmp_packet_rr *)skb_put(skb, packet_len); - if (!access_ok(VERIFY_READ, buff, packet_len)) { - len = -EFAULT; - goto free_skb; - } - - if (__copy_from_user(icmp_packet, buff, packet_len)) { + if (copy_from_user(icmp_packet, buff, packet_len)) { len = -EFAULT; goto free_skb; }