From patchwork Mon Jan 21 09:38:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 214055 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 610182C0079 for ; Mon, 21 Jan 2013 20:38:30 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752040Ab3AUJi0 (ORCPT ); Mon, 21 Jan 2013 04:38:26 -0500 Received: from hotel311.server4you.de ([85.25.146.15]:43943 "EHLO hotel311.server4you.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751459Ab3AUJiZ (ORCPT ); Mon, 21 Jan 2013 04:38:25 -0500 Received: from candlejack.bmw-carit.intra (mail.bmw-carit.de [62.245.222.98]) (Authenticated sender: wagi) by hotel311.server4you.de (Postfix) with ESMTPSA id CE377CBE130; Mon, 21 Jan 2013 10:38:22 +0100 (CET) From: Daniel Wagner To: netdev@vger.kernel.org, cgroups@vger.kernel.org Cc: lizefan@huawei.com, Daniel Wagner , "David S. Miller" , "Eric W. Biederman" , Al Viro , John Fastabend , Neil Horman Subject: [PATCH] net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly Date: Mon, 21 Jan 2013 10:38:22 +0100 Message-Id: <1358761102-7765-1-git-send-email-wagi@monom.org> X-Mailer: git-send-email 1.8.0.rc0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Daniel Wagner Commit 6a328d8c6f03501657ad580f6f98bf9a42583ff7 changed the update logic for the socket but it does not update the SCM_RIGHTS update as well. This patch is based on the net_prio fix commit 48a87cc26c13b68f6cce4e9d769fcb17a6b3e4b8 net: netprio: fd passed in SCM_RIGHTS datagram not set correctly A socket fd passed in a SCM_RIGHTS datagram was not getting updated with the new tasks cgrp prioidx. This leaves IO on the socket tagged with the old tasks priority. To fix this add a check in the scm recvmsg path to update the sock cgrp prioidx with the new tasks value. Let's apply the same fix for net_cls. Reported-by: Li Zefan Cc: "David S. Miller" Cc: "Eric W. Biederman" Cc: Al Viro Cc: John Fastabend Cc: Neil Horman Cc: netdev@vger.kernel.org Cc: cgroups@vger.kernel.org --- net/core/scm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/core/scm.c b/net/core/scm.c index 57fb1ee..905dcc6 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -35,6 +35,7 @@ #include #include #include +#include /* @@ -302,8 +303,10 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) } /* Bump the usage count and install the file. */ sock = sock_from_file(fp[i], &err); - if (sock) + if (sock) { sock_update_netprioidx(sock->sk, current); + sock_update_classid(sock->sk, current); + } fd_install(new_fd, get_file(fp[i])); }