Received: by 10.213.65.68 with SMTP id h4csp1866655imn; Mon, 19 Mar 2018 15:43:31 -0700 (PDT) X-Google-Smtp-Source: AG47ELsV8TYC3glqFSUPA2FOgE2vzky1N0pyA6kxPs2UaA/CngGjIs7oSQ1GzkzSA1w4x/A/8KIr X-Received: by 2002:a17:902:8a93:: with SMTP id p19-v6mr7533118plo.285.1521499411634; Mon, 19 Mar 2018 15:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521499411; cv=none; d=google.com; s=arc-20160816; b=oJCeXodgQAK4I2K+bc0VZrfRrnJkYwDxqkSuAeNYQf2rNoqHiEOGGdtom/3fNFISzU bJQsiAtJ56TCcDZwUGD4/oeO51d9rHgY2WC48pr2U7OfatyGOpHhLyShOOIzJYglJhgo z5BETzH/7h/FiiusjHTW1w7AkplDcKUpWVb7xpV58zIPtolQrtg/Fzks8tnolS6atUK8 JbcdXpe5pNNhwvTf6b82iYn98GYI9cH07+nk0eDwIWutWVrLuOyACf2t/5XmmaNbDa7G tpsTRDB+UKNKSrXY7HugSpTyYeW9gpdlejSofxEhlMHoVDjDCsGCKYuk6FFZ2Gt7TdB6 2INg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=hnAcOmPNjjvSdfr6O0O6CMleSwN8R30LUBVyoVryoK8=; b=ufW0n0SD7VlFfWlGCYBoXvGcopwthJr0uIOyg+cj57uhEW/iaJhQ2oKNqeZDNLw1Xk JbW54HAgmOlCR/Ar40USkbDVx3IWMbexlj0qhqJCaOi+TlAx5bkUyj1NW42mufo4Q0xJ Y8Q8It0bg9M4Wr90nNz56VhvfXUNGMRUhHbU0rUoMfBPoSnj+oiQXnqGZrSe2p2iMj+J RCN4GyYGDFPw1KgNVpwUlslQA1AzB9sb5eU8W0Bx1Afm8IzqZWOs+3mLvW/Enm4zZS+w lCfvfFZM5Vk6JNWy8gRLH8snpnRIOOWyf+wnxI3XOHRS663sbD4f1Tw9bMgoKVo4/m0Q k+Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=E9K+LCh+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k6-v6si259597pln.103.2018.03.19.15.43.16; Mon, 19 Mar 2018 15:43:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=E9K+LCh+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936702AbeCSWkA (ORCPT + 99 others); Mon, 19 Mar 2018 18:40:00 -0400 Received: from mail-by2nam01on0103.outbound.protection.outlook.com ([104.47.34.103]:19764 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933099AbeCSPrW (ORCPT ); Mon, 19 Mar 2018 11:47:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hnAcOmPNjjvSdfr6O0O6CMleSwN8R30LUBVyoVryoK8=; b=E9K+LCh+UN4Z6WRaKWRp4/zNYpw/Bh2Lejf2EyyKMMBKU4Qdysixa1u/jEEJApSIdjjjm1ES9ocRxQg2fK/Q0F4T72PdtpAb4YPUl+mr3GukbMlgCksxPyRoGno5TXdT1ckLJRCNNSGdDS5iLV/raek+ZaBsxzyQIEiWFV9ZwBM= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1013.namprd21.prod.outlook.com (52.132.133.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:47:16 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:47:16 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Sowmini Varadhan , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 017/124] rds; Reset rs->rs_bound_addr in rds_add_bound() failure path Thread-Topic: [PATCH AUTOSEL for 4.15 017/124] rds; Reset rs->rs_bound_addr in rds_add_bound() failure path Thread-Index: AQHTv5mOTCslapjPg0+jgzE7/o1rzQ== Date: Mon, 19 Mar 2018 15:47:16 +0000 Message-ID: <20180319154645.11350-17-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1013;7:jmYvxpuFtc83jWvsEUHbQionhmM3JV6JOX9GgV/L/HthquV9OyDd3z1lORzKEO734EQssJl+T1w8gmVWAnf297GsmQl7BvSqzwphToYf7DnfLC+U1K7ywat3Tij3sUL6oRT9+ULsqJ++jSYZrv/bX7Cz0cLfFjYAit9IfGe8YEbrn8eVG6D+SB9gGHtD+Uyr57MI+oalLiBe+Sm33j9/bW4eCtw7ZdAc1TJbfL7v5PInjKVwlxM309EDwb/EwR7n;20:0RkNa9bXFsV6tcdVkEXixXkaAf8JIFf+bkZFIs+J5hvboID6P8uBtstXb5OhoM8vfp12olP/M2VAdPxe98+FVKyTBw2gGFF0YUW4QhwtH2SPHohAS5IH6q2eaIs65cY6yZmezFqJr827je9UtZY/cfGZAxVZ4sam+jPF+b84z2Y= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d3f5a357-16fe-45ad-6acf-08d58db0b0e4 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1013; x-ms-traffictypediagnostic: DM5PR2101MB1013: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231221)(944501300)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB1013;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1013; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(39860400002)(346002)(376002)(39380400002)(189003)(199004)(86612001)(316002)(26005)(72206003)(4326008)(25786009)(110136005)(10290500003)(86362001)(575784001)(59450400001)(54906003)(53936002)(36756003)(107886003)(3280700002)(14454004)(22452003)(6506007)(5660300001)(68736007)(99286004)(186003)(478600001)(76176011)(2950100002)(10090500001)(102836004)(6116002)(5250100002)(2501003)(97736004)(3660700001)(106356001)(81156014)(81166006)(8676002)(8936002)(7736002)(305945005)(2900100001)(105586002)(3846002)(1076002)(66066001)(6436002)(2906002)(6512007)(6486002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1013;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ++dGyVLJM/54Mb2lHm7U7smxsyw2ng9cEct6oqMNDFvMJIW9Hi0KWWkbO6fjbLj4uxlr9m1ur1s59rF73HpJ3wNk30xcxTq1kKcCpsDgCIXNkkrNvhFJBRfvNHWZwdhnd/UiG+niwtKvD+6DueTdh1obbtFCxOZn0nzfP5CbCAU8WbwjTvBJTSIOecz657YesveyMGnzMo3G5/zvVLrYMmHLejq+ffExjAyEo8vUXEd13Ps+2rNN+DU/zqFdw6l6AC82rsieY33ztHHVxwSabkh/Dh6NdtN7EBZzg5mzLI+fGbmnAOzsifEODLUPKpcmC7k1w2xAoHCeFP4v1wY3Gg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3f5a357-16fe-45ad-6acf-08d58db0b0e4 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:47:16.3142 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1013 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sowmini Varadhan [ Upstream commit 7ae0c649c47f1c5d2db8cee6dd75855970af1669 ] If the rds_sock is not added to the bind_hash_table, we must reset rs_bound_addr so that rds_remove_bound will not trip on this rds_sock. rds_add_bound() does a rds_sock_put() in this failure path, so failing to reset rs_bound_addr will result in a socket refcount bug, and will trigger a WARN_ON with the stack shown below when the application subsequently tries to close the PF_RDS socket. WARNING: CPU: 20 PID: 19499 at net/rds/af_rds.c:496 \ rds_sock_destruct+0x15/0x30 [rds] : __sk_destruct+0x21/0x190 rds_remove_bound.part.13+0xb6/0x140 [rds] rds_release+0x71/0x120 [rds] sock_release+0x1a/0x70 sock_close+0xe/0x20 __fput+0xd5/0x210 task_work_run+0x82/0xa0 do_exit+0x2ce/0xb30 ? syscall_trace_enter+0x1cc/0x2b0 do_group_exit+0x39/0xa0 SyS_exit_group+0x10/0x10 do_syscall_64+0x61/0x1a0 Signed-off-by: Sowmini Varadhan Acked-by: Santosh Shilimkar Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/rds/bind.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/rds/bind.c b/net/rds/bind.c index 75d43dc8e96b..5aa3a64aa4f0 100644 --- a/net/rds/bind.c +++ b/net/rds/bind.c @@ -114,6 +114,7 @@ static int rds_add_bound(struct rds_sock *rs, __be32 ad= dr, __be16 *port) rs, &addr, (int)ntohs(*port)); break; } else { + rs->rs_bound_addr =3D 0; rds_sock_put(rs); ret =3D -ENOMEM; break; --=20 2.14.1