From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752103AbbJLMA3 (ORCPT ); Mon, 12 Oct 2015 08:00:29 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:57874 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751401AbbJLMA2 (ORCPT ); Mon, 12 Oct 2015 08:00:28 -0400 From: Arnd Bergmann To: huangdaode Cc: davem@davemloft.net, joe@perches.com, liguozhu@hisilicon.com, Yisen.Zhuang@huawei.com, netdev@vger.kernel.org, linuxarm@huawei.com, salil.mehta@huawei.com, kenneth-lee-2012@foxmail.com, xuwei5@hisilicon.com, lisheng011@huawei.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v2 1/2] hisilicon net: removes the once HANDEL_TX_MSG macro Date: Mon, 12 Oct 2015 13:59:39 +0200 Message-ID: <6398202.hrOAl1xuJE@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1444620225-2339-2-git-send-email-huangdaode@hisilicon.com> References: <1444620225-2339-1-git-send-email-huangdaode@hisilicon.com> <1444620225-2339-2-git-send-email-huangdaode@hisilicon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:Bgza+atqmUFnWMWJycyTnk+x1cumVcBM3PwjL09qcUWEmR6C1Aw WdfouyCGHnr04VS1bZxXGM9L9KvywMRo4t4rJPQuvZCog2P4bPRUS2dGuCvag5FQcSEhy7N xC0O5yZKdKEGwEDeneRsLdYW+2ajwzhognilO7Hl05RdsoOTiAvb5ZEbtmNDJlO94o52C/p 1qrUmBY5lZ+Tnwih8vwxw== X-UI-Out-Filterresults: notjunk:1;V01:K0:Rb09g3fxjxg=:LrWCK4x3pQQR49cFs9nrt1 RNlnRxpdyB9YKBQ3qdO1/p1PkGlsiP/USYcGtgVSgrhGcAKvL0qIap1DktBNAbU5L9pRXcYoX ZVxXGMofkzwDLT27VEDy1gWKj3K/xDNfllxIHNpJcgG9t5kBKPNCwZ8galFHikNHopY1kBt37 bNdvj3GFmjtjvRndtjYLq/TKD2B1PLI8lBVb/rHuam7kCqZnmDXGSJUgmrRKDv3jaUKHMJAQ/ ClCqiJ7MSASyi84WCy7SB+ecE9LCeUmPdm9Iy/fGbgPp+XP1OtyKJ+27O6fyWZJp4il7L1CHY J14oRBtTL2eVXhINYqse0Id3Xp0mMlQv48+cEiGHBKOBtVWWWhO6A9a2ZTO+u/M8gVreaoCXo WL+du99h9SxBXhLiBke2BN4v8wSov4n/ujmM9LuBoRzp1XZRZNKl2XFPxwz3Tzv7IwcrMz/1q JDmM0Uqhc57g1qy8OEpm47iP5jD1iyaY+7aQ5jFgOQ/9n50qHJdVIhc9wqG+xEkXWWDIcmbw8 EOoGSUc2bQBdKMIhDOtEK4RBzzmPopkHc3E7tBl1jmgdE/XkHeX9PgGrspJaaPY399tzvsYPQ 3t1Jvh9ASmV6RsoekWFciZGgAFQQkMFCiMFtA782Rgun0XPNST6BlbTiukoY86RQvy6hLumwS vYzoETy6iscwSuENOY6Ph9bhwTnBbxbxeqsGlcN1vVuF0+aJtJeXVo+HadiFL3eE8yehunbEr I21tpoZsQmRn+fFY Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 12 October 2015 11:23:44 huangdaode wrote: > + s += sprintf(s, > + "\t\ttx_ring on %p:%u,%u,%u,%u,%u,%llu,%llu\n", > + h->qs[i]->tx_ring.io_base, > + h->qs[i]->tx_ring.buf_size, > + h->qs[i]->tx_ring.desc_num, > + h->qs[i]->tx_ring.max_desc_num_per_pkt, > + h->qs[i]->tx_ring.max_raw_data_sz_per_desc, > + h->qs[i]->tx_ring.max_pkt_size, > + h->qs[i]->tx_ring.stats.sw_err_cnt, > + h->qs[i]->tx_ring.stats.io_err_cnt); There is actually a more significant problem with this code, which I failed to notice when doing the original bugfix: You have a sysfs interface here that exports internal data of the device that should not be visible like this. One problem is that the io_base is a kernel pointer that must not be visible to non-root users (so we don't easily create an attack surface for exploits). Another problem is that the format is not documented in Documentation/ABI/ and that you have multiple values in one sysfs file here. It would probably be better to completely remove that sysfs interface, and to use the ethtool netlink interface to export them. Arnd