Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752116AbdFJNSN (ORCPT ); Sat, 10 Jun 2017 09:18:13 -0400 Received: from sessmg22.ericsson.net ([193.180.251.58]:58175 "EHLO sessmg22.ericsson.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751838AbdFJNSK (ORCPT ); Sat, 10 Jun 2017 09:18:10 -0400 X-AuditID: c1b4fb3a-307ff70000004a6a-01-593bf18f0f49 From: Jon Maloy To: Jia-Ju Bai , Ying Xue , "davem@davemloft.net" CC: "netdev@vger.kernel.org" , "tipc-discussion@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] net: tipc: Fix a sleep-in-atomic bug in tipc_msg_reverse Thread-Topic: [PATCH] net: tipc: Fix a sleep-in-atomic bug in tipc_msg_reverse Thread-Index: AQHS4cgc1cDOA6chiUG+N2snElps36IeE59A Date: Sat, 10 Jun 2017 13:18:03 +0000 Message-ID: References: <1497085415-630-1-git-send-email-baijiaju1990@163.com> In-Reply-To: <1497085415-630-1-git-send-email-baijiaju1990@163.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: 163.com; dkim=none (message not signed) header.d=none;163.com; dmarc=none action=none header.from=ericsson.com; x-originating-ip: [198.24.6.220] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB5PR0701MB2023;7:s+on9l8at1bLcnP85U6x6qApM/v4+QA/YibSYqxaP6ppOpewRRv2xLskuwp9mrIpJbEs2K/w8nXkrHV7Zvpp6HcYHjqY/DNtXwbkO1d6gKBWvrFf7SnhHBx3ecdatYDRMNTetCAPO5TVkp6qeKY6puKV4M2FcdEszUMhShA0+Sq4wtYT9BmP/1Tdp1CLJd8Q8bXlCmtXkmFK0uunx798TetX1gSvpFzFNPLtQlZ1nccg6DVtNMpRrxL2EznookXGyTgI6kuLihK0I0g0V1VSuDSbw2L48iU8RSVib4YCvWY4KSU7SGtb287YkzsWnhjWEPuPHP7zsJrikXfuhhtU5cey2LH3HKFBiAyDb5KpIPkgEL5xyQBjdRP20nDrZ0Mw+UuRPm6A4SPGiUHe4N+N8q/O0gNLABgaOFCiX3nTo1nWj9/o4vYtfZ9wC6TyQ7ukp3A5PK/MEm+Ht0KASqRDU7ec4CijcAswVzvN3ZQmE5f6NMtmGe938/lUKIRUXo6wGCyNY2k8iWxlHvdDHTMGDIUsfH+woBNsY1JZrCAL19XfwkmWuv4bsr5xDG9Oh875HNdnj4W1sH+0ff3HOw0Gh6N5S53KJZ3KE1Sws+ZmMR3Dr+M9EcEc2kg+i+ZjNh2dc3q6iVxaYVin7skTwAZM9qQdGKMyE8fGCfiZyDLYnfSjiv0mPLYcXEs2QjCwjvezZZgSS2OUsI8psGTTME23NGIR0jY/h3LLoAPfGdWxzeMHYBkP3jg8APhhO7gzn91wIKNL7U6YBJdlh6nlEr9zoiX4rCVY+Thulj3lOEVfDjo= x-ld-processed: 92e84ceb-fbfd-47ab-be52-080c6b87953f,ExtAddr x-ms-traffictypediagnostic: DB5PR0701MB2023: x-ms-office365-filtering-correlation-id: 084a6149-a190-4b55-466a-08d4b0032036 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(201703131423075)(201703031133081);SRVR:DB5PR0701MB2023; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(37575265505322)(143289334528602)(9452136761055)(42262312472803)(130843839470238); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(3002001)(6041248)(20161123560025)(20161123555025)(20161123564025)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB5PR0701MB2023;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB5PR0701MB2023; x-forefront-prvs: 0334223192 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(39850400002)(39400400002)(39410400002)(39840400002)(39450400003)(13464003)(305945005)(7736002)(8936002)(5660300001)(74316002)(53546009)(25786009)(81166006)(8676002)(4326008)(230783001)(6436002)(6506006)(66066001)(2900100001)(478600001)(54906002)(9686003)(189998001)(14454004)(7696004)(5250100002)(55016002)(99286003)(2501003)(53936002)(33656002)(3660700001)(3280700002)(6246003)(2950100002)(38730400002)(2906002)(50986999)(229853002)(76176999)(54356999)(86362001)(102836003)(3846002)(31853002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR0701MB2023;H:DB5PR0701MB1958.eurprd07.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jun 2017 13:18:03.6338 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR0701MB2023 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA02SbUhTURzGObv3zut0dVq+/LEXcxRlrmnWh5ESpoH7YhlE6rB05EVNnbZr litiH0TS+ZbKdLp8wZkvKJWZ7wlqiCmlJoqJHyQ1s1GYgn5QNHfvgr79/ud5nj/nORyakFRT HnSiJp3RatTJUqGINEV23jxX9Ccgyq/DJFdUlxYIFObxLFIx1WMWKoZr3BTt4/eCKGVdYyml bG/6KlD21mwIlBttx8NJlSgwjklOzGC0vpdjRQmb/W+JtDnnR73mUQc9KhLlIkca8EWYt5Y5 5CIRLcEfECztNSB+GEGQt9DJDSTOJ2Ch8DXFK1UC+G3esWeWEWS9/+5gWybEZ2DV+AzZ2AU/ BMNQAWkzEXgMQVfrrsAmHMZhsPN8RsibrkHZzxGKZ38oXMniwiQ+BRXWQdLGYhwLLSWTnEeC g2G48Q23xxGHQKtximOE3WBrtIVjArvD3FK1gG+HwdI3TvDsCquLu1wFhHMQzG6O2U0nYHRa j3g+Bl+qDVxpwN+EYLXk2IVAKDeU2TfJYHTSbA+HwVD3LMUH9AgqG0x2IRVKe36QPD+GvtZ6 IW8apmBtc91uOgoNWxuoCMkq/rs6zzKo6V0X8uwDL2utRAX3HIfgo2mJrEFkM3JlGZZNiff3 lzPaxLssm6qRa5j0NrT/bQbaty91oYGVK4MI00jqLH66FhAlodQZbGbKIAKakLqI637tH4nj 1Jk6Rpsao32QzLCD6AhNSt3FQf0TkRIcr05nkhgmjdH+UwW0o4ceUXrPF6qT3q6WIEt7dMi8 7nYMvTdD3e+v0h3YzSYP6vac3iWNDIcuGZN6XSYYlVfnhScdJcueO02m0AWf7GyjIeLWdmf4 De+uZYPbneJ8a7HT58Xrmqte25VK3+iM8uC82ldGo1+FLPBTmEqp7673KF6WTUdkNMtDhOLT E3qZlGQT1OfPElpW/RfBhs+RMgMAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v5ADIQk5012431 Content-Length: 1556 Lines: 53 Acked. ///jon > -----Original Message----- > From: Jia-Ju Bai [mailto:baijiaju1990@163.com] > Sent: Saturday, June 10, 2017 05:04 > To: Jon Maloy ; Ying Xue > ; davem@davemloft.net > Cc: netdev@vger.kernel.org; tipc-discussion@lists.sourceforge.net; linux- > kernel@vger.kernel.org; Jia-Ju Bai > Subject: [PATCH] net: tipc: Fix a sleep-in-atomic bug in tipc_msg_reverse > > The kernel may sleep under a rcu read lock in tipc_msg_reverse, and the > function call path is: > tipc_l2_rcv_msg (acquire the lock by rcu_read_lock) > tipc_rcv > tipc_sk_rcv > tipc_msg_reverse > pskb_expand_head(GFP_KERNEL) --> may sleep tipc_node_broadcast > tipc_node_xmit_skb > tipc_node_xmit > tipc_sk_rcv > tipc_msg_reverse > pskb_expand_head(GFP_KERNEL) --> may sleep > > To fix it, "GFP_KERNEL" is replaced with "GFP_ATOMIC". > > Signed-off-by: Jia-Ju Bai > --- > net/tipc/msg.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 312ef7d..ab30876 100644 > --- a/net/tipc/msg.c > +++ b/net/tipc/msg.c > @@ -508,7 +508,7 @@ bool tipc_msg_reverse(u32 own_node, struct > sk_buff **skb, int err) > } > > if (skb_cloned(_skb) && > - pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, > GFP_KERNEL)) > + pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, > GFP_ATOMIC)) > goto exit; > > /* Now reverse the concerned fields */ > -- > 1.7.9.5 >