From patchwork Mon Oct 30 22:18:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10033323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18AB4600C5 for ; Mon, 30 Oct 2017 22:19:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A2A32899E for ; Mon, 30 Oct 2017 22:19:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E6F1289AF; Mon, 30 Oct 2017 22:19:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1381E289B5 for ; Mon, 30 Oct 2017 22:18:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753351AbdJ3WSM (ORCPT ); Mon, 30 Oct 2017 18:18:12 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:48766 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752712AbdJ3WSL (ORCPT ); Mon, 30 Oct 2017 18:18:11 -0400 Received: by mail-wm0-f66.google.com with SMTP id p75so18783114wmg.3 for ; Mon, 30 Oct 2017 15:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=gjDBCtMGU9ETvL+CnOPCd+Ek9yOY4ICDUeSw4TtUpQs=; b=qb8ICKW/YZ+TlTLKR6uYhbmi81Og/HrOmaCLhMxAcHfnaN7Ct8+dwjFfklhsBm9dHU gq4U1xPb0XxmKksbP4nxG0Dn3zXXy3yW3lfoVUtznpCJTP4vtODs576P7Ix9eBIuIgHo /ICrI8SRI5WgIXt61BLTtuzijeHKxzCXW3GWH556iM7jx0hdshoEFTlAFjsY001PtkB5 aBQyD7DJ5QI2AzoCKUreAlMSqx1e9nsY8NasZ0sbzzm9kz3g55nqEwlKpg36NkGXwwMN K/Q5kc1qcyHZivdYe0ib0+44kbl6+koOlPLSRhqK66HQdCILStB/d9CUIlbkH8h4/J2Q Cffg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=gjDBCtMGU9ETvL+CnOPCd+Ek9yOY4ICDUeSw4TtUpQs=; b=uYMEfDrALADoDnI5ne+16TBGco10vnKeeqg42jz0wNf9sT5K1NdCJILWe76Etigday P/R9HekMzHwO1P44P5G2dcr/9OIp6CYGI/EYxLoTnDRq3qH2bINbhLcX6OscZ9+FkUwJ KeCfHRnjGBAfYbjrqh4nek3gr72HaBVPH6LrwsdUNuOZzs2vQ07UboBMElTULB0uF5ea Lh4QsfiS0MN7a1qMz4Z4A3dCjLjkpk9KH2TGDai1Lz8wB21Z7YH7rRpDr8Odl+IG/ztw VRttNN0WSI3Qv2ELXtG0wh/S57yqWMt6/11fOk5+W0T/J8PXeV1O91yjLVxPzYhFtTlb c8cA== X-Gm-Message-State: AMCzsaXZpf0z3QLJhbMXAPG28rS9qnnhvyVIAHuO/Qg1q8HsN+5X8TMF HWJMCLxFmoZ2ZXL5pY/OkYMNOw== X-Google-Smtp-Source: ABhQp+ShI900q2R3LfPYGYEaZ+OzIUQ+qP58RJjBjOjXEbspjUMgZn0wRJzTQwf76hPsW4S6FeBfmA== X-Received: by 10.28.170.9 with SMTP id t9mr149113wme.148.1509401890103; Mon, 30 Oct 2017 15:18:10 -0700 (PDT) Received: from dvbdev.wuest.de (ip-37-201-239-211.hsi13.unitymediagroup.de. [37.201.239.211]) by smtp.gmail.com with ESMTPSA id o13sm4405687wrc.10.2017.10.30.15.18.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Oct 2017 15:18:09 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH] [media] dvb-core: dvb_frontend_handle_ioctl(): init err to -EOPNOTSUPP Date: Mon, 30 Oct 2017 23:18:08 +0100 Message-Id: <20171030221808.4642-1-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.6 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Scheller Fixes: d73dcf0cdb95 ("media: dvb_frontend: cleanup ioctl handling logic") The mentioned commit cleaned up the ioctl handling, but caused an issue with the DVBv3 when they're not defined in a frontend's fe_ops: When a userspace application checks for existence and success of a fe_ops with ie. if (!ioctl(fd, FE_READ_BER, &val)) this will not report failure anymore since in dvb_frontend_handle_ioctl(), err is unitialised and thus zero, and "case FE_READ_BER" (and the following) doesn't care about the case that fe_op isn't set by the frontend driver. So, success is always reported while the value at the passed ptr isn't updated. This breaks userspace applications relying on v3 stats. Fix this by initialising err to -EOPNOTSUPP like it was before the commit. This only affects (and fixes) the DVBv3 stat ioctls, every other handled ioctl sets err to a proper return value. Signed-off-by: Daniel Scheller --- Discovered and tested with TVHeadend (current GIT master HEAD) which does fallback to DVBv3 stats inquiry when v5 is absent. drivers/media/dvb-core/dvb_frontend.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index daaf969719e4..cc64fa38a1df 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -2113,6 +2113,8 @@ static int dvb_frontend_handle_ioctl(struct file *file, dev_dbg(fe->dvb->device, "%s:\n", __func__); + err = -EOPNOTSUPP; + switch (cmd) { case FE_SET_PROPERTY: { struct dtv_properties *tvps = parg;