Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1618506

Re: [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when dev_private is invalid

From jeffy <jeffy.chen@rock-chips.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when dev_private is invalid
Date 2017-04-07 08:50 +0200
Message-ID <ttvSx-3C4-13@gated-at.bofh.it> (permalink)
References (1 earlier) <tsODU-f3-39@gated-at.bofh.it> <tsW8p-51d-1@gated-at.bofh.it> <ttaXM-63S-21@gated-at.bofh.it> <ttdCh-7Mq-1@gated-at.bofh.it> <ttvIS-3yA-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Daniel,

On 04/07/2017 02:30 PM, Daniel Vetter wrote:
> On Thu, Apr 6, 2017 at 1:09 PM, jeffy <jeffy.chen@rock-chips.com> wrote:
>>
>> On 04/06/2017 04:26 PM, Daniel Vetter wrote:
>>>
>>> On Wed, Apr 05, 2017 at 12:28:40PM -0400, Sean Paul wrote:
>>>>
>>>> On Wed, Apr 05, 2017 at 04:29:26PM +0800, Jeffy Chen wrote:
>>>>>
>>>>> After unbinding drm, the userspace may still has a chance to access
>>>>> gem buf.
>>>>>
>>>>> Add a sanity check for a NULL dev_private to prevent that from
>>>>> happening.
>>>>
>>>>
>>>> I still don't understand how this is happening. You're saying that these
>>>> hooks
>>>> can be called after rockchip_drm_unbind() has finished?
>>>
>>>
>>> Yeah this is supposed to be impossible. If it isn't, we need to debug and
>>> fix this properly. This smells like pretty bad duct-tape ...
>>
>>
>> it looks like after unbind, the user space may still own drm dev fd, and
>> could be able to call ioctl:
>> lrwx------. 1 chronos chronos 64 Mar 15 12:53 28 -> /dev/dri/card1 (deleted)
>>
>> and the drm_unplug_dev may help it, maybe we should call it in unbind? or
>> just break drm_ioctl when drm_dev not registered?
>
> Yes, by default unbind while userspace is running is totally broken in
> drm. drm_unplug_dev would be the fix, but it's only used by udl and
> not many use that. You might need to fix infrastructure up a bit.
please check this patch:
9667071 New          [v5,12/12] drm/drm_ioctl.c: Break ioctl when drm 
device not registered
>
> For normal module unload the module reference will prevent unloading.
> So why exactly do you care about the unbind use-case?
sometimes we use unbind/bind for testing ;)
> -Daniel
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/9] drm: rockchip: Fix rockchip drm unbind crash error Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-04-05 10:40 +0200
  [PATCH v3 2/9] drm: bridge: analogix: Unregister dp aux when unbinding Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-04-05 10:40 +0200
    Re: [PATCH v3 2/9] drm: bridge: analogix: Unregister dp aux when  unbinding Andrzej Hajda <a.hajda@samsung.com> - 2017-04-06 09:20 +0200
      Re: [PATCH v3 2/9] drm: bridge: analogix: Unregister dp aux when  unbinding jeffy <jeffy.chen@rock-chips.com> - 2017-04-06 14:20 +0200
  [PATCH v3 3/9] drm: bridge: analogix: Destroy connector when unbinding Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-04-05 10:40 +0200
    Re: [PATCH v3 3/9] drm: bridge: analogix: Destroy connector when  unbinding Andrzej Hajda <a.hajda@samsung.com> - 2017-04-06 09:30 +0200
      Re: [PATCH v3 3/9] drm: bridge: analogix: Destroy connector when  unbinding jeffy <jeffy.chen@rock-chips.com> - 2017-04-06 14:30 +0200
  [PATCH v3 4/9] drm/rockchip: cdn-dp: Don't try to release firmware when not loaded Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-04-05 10:40 +0200
  [PATCH v3 6/9] drm/rockchip: Reoder drm bind/unbind sequence Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-04-05 10:40 +0200
  [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when dev_private is invalid Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-04-05 10:40 +0200
    Re: [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when  dev_private is invalid Sean Paul <seanpaul@chromium.org> - 2017-04-05 18:40 +0200
      Re: [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when  dev_private is invalid jeffy <jeffy.chen@rock-chips.com> - 2017-04-06 05:00 +0200
        Re: [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when  dev_private is invalid Sean Paul <seanpaul@chromium.org> - 2017-04-06 14:30 +0200
          Re: [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when  dev_private is invalid jeffy <jeffy.chen@rock-chips.com> - 2017-04-06 15:00 +0200
      Re: [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when  dev_private is invalid Daniel Vetter <daniel@ffwll.ch> - 2017-04-06 10:30 +0200
        Re: [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when  dev_private is invalid jeffy <jeffy.chen@rock-chips.com> - 2017-04-06 13:20 +0200
          Re: [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when  dev_private is invalid Daniel Vetter <daniel@ffwll.ch> - 2017-04-07 08:40 +0200
            Re: [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when  dev_private is invalid jeffy <jeffy.chen@rock-chips.com> - 2017-04-07 08:50 +0200
              Re: [PATCH v3 8/9] drm/rockchip: gem: Don't alloc/free gem buf when  dev_private is invalid Daniel Vetter <daniel@ffwll.ch> - 2017-04-07 09:20 +0200
  [PATCH v3 7/9] drm/rockchip: Shutdown all crtcs when unbinding drm Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-04-05 10:40 +0200
  [PATCH v3 1/9] drm: bridge: analogix: Detach panel when unbinding analogix dp Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-04-05 10:40 +0200
    Re: [PATCH v3 1/9] drm: bridge: analogix: Detach panel when unbinding  analogix dp Andrzej Hajda <a.hajda@samsung.com> - 2017-04-06 09:00 +0200

csiph-web