From patchwork Tue Jul 24 08:40:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 948254 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41ZWzM3jkTz9s5H; Tue, 24 Jul 2018 18:41:01 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fhssH-0002oI-JB; Tue, 24 Jul 2018 08:40:53 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fhssG-0002o0-05 for kernel-team@lists.ubuntu.com; Tue, 24 Jul 2018 08:40:52 +0000 Received: from 1.general.ppisati.uk.vpn ([10.172.193.134] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fhssF-0007kP-NY for kernel-team@lists.ubuntu.com; Tue, 24 Jul 2018 08:40:51 +0000 From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2] UBUNTU: SAUCE: import sock_efree() Date: Tue, 24 Jul 2018 10:40:50 +0200 Message-Id: <1532421650-17137-3-git-send-email-paolo.pisati@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532421650-17137-1-git-send-email-paolo.pisati@canonical.com> References: <1532421650-17137-1-git-send-email-paolo.pisati@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" CVE-2017-6345 Instead of importing sock_efree() i could have used sock_edemux() since the two behave similarly, except when the passed socket is a TCP socket in the TCP_TIME_WAIT state. But since the TCP states are represented using an enum and the field sk_state is reused by every protocol, i preferred to avoid introducing a subtle mistake and use the original sock_efree() function. (partially backported from commit 62bccb8cdb69051b95a55ab0c489e3cab261c8ef) Signed-off-by: Paolo Pisati --- include/net/sock.h | 1 + net/core/sock.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/net/sock.h b/include/net/sock.h index db6e0ee..124e683 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1550,6 +1550,7 @@ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, void sock_wfree(struct sk_buff *skb); void skb_orphan_partial(struct sk_buff *skb); void sock_rfree(struct sk_buff *skb); +void sock_efree(struct sk_buff *skb); void sock_edemux(struct sk_buff *skb); int sock_setsockopt(struct socket *sock, int level, int op, diff --git a/net/core/sock.c b/net/core/sock.c index d387778..a2702d5 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1676,6 +1676,12 @@ void sock_rfree(struct sk_buff *skb) } EXPORT_SYMBOL(sock_rfree); +void sock_efree(struct sk_buff *skb) +{ + sock_put(skb->sk); +} +EXPORT_SYMBOL(sock_efree); + void sock_edemux(struct sk_buff *skb) { struct sock *sk = skb->sk;