From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30522C43141 for ; Thu, 14 Nov 2019 15:54:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 078AA206F0 for ; Thu, 14 Nov 2019 15:54:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="hIJ4WdJ5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726977AbfKNPyQ (ORCPT ); Thu, 14 Nov 2019 10:54:16 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:43163 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726339AbfKNPyP (ORCPT ); Thu, 14 Nov 2019 10:54:15 -0500 Received: by mail-qk1-f196.google.com with SMTP id z23so5357410qkj.10 for ; Thu, 14 Nov 2019 07:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=myBRwdIDZM+Djx89Bjwq7BC5pRJnKbB6UM2UOeE1ngM=; b=hIJ4WdJ5jLRRBKUeeeQYewM0jfBPnGo2ACjOPRADok7azxxt/mq+Xu0ZcrHBEURYx5 ahJpC1hjBbHDu4genHAKTCpFr4ZdFDdWB30DzFHfUtjBxk8Pak1MA1+2zYI+ZIHo59si uYQd2/mjzJUvpYm46EsyViPmpkRYxll9vWL0o3qz0YZDUto0u42GLl3Dw9C+TvtWK9gP HoidKjHn5rbZzxrd4Pha7PAhjBgSgqP/eP0UzbNS30JBp9uCcfAN6tnxQAbF6LlcaNKh 2xnq6RLNunTsrQDvF3FRvsDRN6ho8dqVUz8UntG4rqZsJn4a6wU5nMIYgm7lN+xYDtbW uCOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=myBRwdIDZM+Djx89Bjwq7BC5pRJnKbB6UM2UOeE1ngM=; b=pwj+qrY+i9Yz5jQR0tpLSL044YgMvUUrJQubSXlZFJAH+w33ui+lOCzcT54OVgZyFU dQk9yEqim8rkuu8rIwB2YL/1aBNS+YdY/utfozOsGRnOjNGYbOuBR3ObFAodBNDd+4Eq pSsdWS3rsBszVosKVE+QwYnWeT/V7+4rg9YdLeQHciwE7yHfQ7JaO97VyX0CSYCpRhQS VkAqe3QPpxqIxt98p/aGOostn/nNAp22QdOxWVXRvMXU0hKf0qncD2gKm345rBv3LymU GnTbbu929G7L68+c1QZ/uZ3LgM7baFMxTjCad6bsiszqVEEu4DjFrqRS9pdYpcSrenjg V1Ng== X-Gm-Message-State: APjAAAWPiQK/ZGnZ8lB4e1RwoEBy1dAjzvWLLV2Y0k9QFOZvVodFHJy3 LqGtyhdZXgr7qnnuFNl7s1LSzg== X-Google-Smtp-Source: APXvYqwBG7oO5AQ60VNus1jTs0EnXEv8zPuEped9XQRtFUTUc+wX8i+pnFxeVhu9jneS34v/MggT9A== X-Received: by 2002:a37:a104:: with SMTP id k4mr8108780qke.412.1573746854820; Thu, 14 Nov 2019 07:54:14 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-113-180.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.180]) by smtp.gmail.com with ESMTPSA id t26sm3468891qta.75.2019.11.14.07.54.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2019 07:54:14 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1iVHRl-0007bZ-SW; Thu, 14 Nov 2019 11:54:13 -0400 Date: Thu, 14 Nov 2019 11:54:13 -0400 From: Jason Gunthorpe To: Viresh Kumar Cc: Dennis Dalessandro , Mike Marciniszyn , Greg Kroah-Hartman , Vincent Guittot , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] IB/qib: Validate ->show()/store() callbacks before calling them Message-ID: <20191114155413.GA29207@ziepe.ca> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 07, 2019 at 08:50:25AM +0530, Viresh Kumar wrote: > The permissions of the read-only or write-only sysfs files can be > changed (as root) and the user can then try to read a write-only file or > write to a read-only file which will lead to kernel crash here. > > Protect against that by always validating the show/store callbacks. > > Signed-off-by: Viresh Kumar > --- > drivers/infiniband/hw/qib/qib_sysfs.c | 6 ++++++ > 1 file changed, 6 insertions(+) Applied to for-next, thanks Jason