Received: by 10.213.65.68 with SMTP id h4csp858350imn; Tue, 27 Mar 2018 10:03:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/gogBeRA+KyVfBV2dJ6pbM+1t06ut/evqS8hAHL1B1sH06X/Y/xrQyBkxJIdqO5khGTFQc X-Received: by 10.99.3.216 with SMTP id 207mr80665pgd.163.1522170239550; Tue, 27 Mar 2018 10:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522170239; cv=none; d=google.com; s=arc-20160816; b=XyRanwzI5zWetuFIY1uk6cNVucg9exnNNBjy4hgLMURcK3QiZh0S43gRLFCFCx4Qst WEB/r6mXDYsBpglLf8VruuoCLjIpDNBuJKdJqe/n9VNX5UOxih+i3JWJASLTUJd0xUew R/DvcTj2x08Zca5Z+k+2VSXLylTHr6C4An4+VKtxRJp4MfR+cVRFhB13GI6pituiiA9l oZGHZz8DrVNHHzvFWFYPKLB14qd7d4rLUQAxru2vP7jcxUY6OMFR3MMcGLMFxl2mV3Hm K7XrKO5xMy39WjkDnLp5o+pbyF1mgsNt6pNOv/qwgUdbieKlzPJtbKCJx0i+V6Wv1duE JrNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=NJwtfjVcBeeCosBjP7eg+Ezk2dMSpT99P0XvyueRQio=; b=i6b8aAMQUwQI5xHG5rRKhn+fdbMpXN7fiBSR8Dgq4BGT0aJud2lAJGLU/az6NTnTKg x1f0qh81GL20fZ8Hy/vBZkyi9+LIol9WIT0O1CmSnhUL7OBLzWSXo76KdOC6cXi26umU gPKbwhC2IrKm6PY5zzxwepmkAe452nfRZoWJHRjkZpkPn9vNjoFwNvJefYvZilD+noM0 pm/C12+bLm+Ktfr1KLvSvcIozsWjfNmOYeuMhj+b3NC5BOtEYjc1eCDB2Nit7gvnMw6U XytUyL/DoQaoMYsCLvsyXvfKWpXzJAXoMBzNMnWJ0FOuYgko/x+p/VeaDbRhFBHdKPTl Fjdw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69-v6si1595024pla.390.2018.03.27.10.03.40; Tue, 27 Mar 2018 10:03:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755362AbeC0RCE (ORCPT + 99 others); Tue, 27 Mar 2018 13:02:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48648 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755091AbeC0QlP (ORCPT ); Tue, 27 Mar 2018 12:41:15 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 53522F36; Tue, 27 Mar 2018 16:41:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jessica Yu , Linus Torvalds , Leon Yu Subject: [PATCH 4.15 063/105] module: propagate error in modules_open() Date: Tue, 27 Mar 2018 18:27:43 +0200 Message-Id: <20180327162801.512350533@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162757.813009222@linuxfoundation.org> References: <20180327162757.813009222@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Leon Yu commit 3f553b308bb004eb730da8e00a28150c157c7724 upstream. otherwise kernel can oops later in seq_release() due to dereferencing null file->private_data which is only set if seq_open() succeeds. BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 IP: seq_release+0xc/0x30 Call Trace: close_pdeo+0x37/0xd0 proc_reg_release+0x5d/0x60 __fput+0x9d/0x1d0 ____fput+0x9/0x10 task_work_run+0x75/0x90 do_exit+0x252/0xa00 do_group_exit+0x36/0xb0 SyS_exit_group+0xf/0x10 Fixes: 516fb7f2e73d ("/proc/module: use the same logic as /proc/kallsyms for address exposure") Cc: Jessica Yu Cc: Linus Torvalds Cc: stable@vger.kernel.org # 4.15+ Signed-off-by: Leon Yu Signed-off-by: Jessica Yu Signed-off-by: Greg Kroah-Hartman --- kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/module.c +++ b/kernel/module.c @@ -4223,7 +4223,7 @@ static int modules_open(struct inode *in m->private = kallsyms_show_value() ? NULL : (void *)8ul; } - return 0; + return err; } static const struct file_operations proc_modules_operations = {