Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* Re: [PATCH 5/5] s3fb: use new start address register
From: Ondrej Zajicek @ 2011-03-03  8:50 UTC (permalink / raw)
  To: Ondrej Zary; +Cc: Ondrej Zajicek, linux-fbdev, Kernel development list
In-Reply-To: <201103012018.45635.linux@rainbow-software.org>

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

On Tue, Mar 01, 2011 at 08:18:43PM +0100, Ondrej Zary wrote:
> Use "new" start address register 0x69 (bits 16-20) instead of "old" 0x31
> (bits 16-17) and 0x51 (bits 18-19). This is needed for panning to work
> correctly on Trio3D/2X cards (and does no harm on other ones).
> 
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

Acked-by: Ondrej Zajicek <santiago@crfreenet.org>

-- 
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: santiago@crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: (WARNING) possible deadlock in del_timer_sync, called from fbcon_del_cursor_timer
From: Yong Zhang @ 2011-03-03  9:12 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Clemens Ladisch, linux-fbdev, linux-kernel, Thomas Gleixner,
	Andrew Morton, Jesse Barnes, Denys Vlasenko, Jason Wessel
In-Reply-To: <20110302181223.GD9288@home.goodmis.org>

On Thu, Mar 3, 2011 at 2:12 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Mon, Feb 28, 2011 at 03:41:07PM +0100, Clemens Ladisch wrote:
>> While using the FB console, I tried to change the console log level
>> with SysRq, and got this warning that del_timer_sync() is used in
>> an interrupt handler:
>
> Ug, del_timer_sync() can be called from interrupt context:
>
> printk -> vt_console_print -> hide_cursor -> fbcon_cursor
> -> fbcon_del_cursor_time -> del_timer_sync()
>
> printk is allowed to be called from interrupt context. This is indeed a
> true bug.

Yeah.

And more explanation for that WARN_ON() :)

run_timer_softirq(SOFTIRQ context)
  cursor_timer_handler()
  Interrupt comes in(IRQ context)
    ...
      del_timer_sync()
        deadlock

So fbcon guys:
Could above situation happen?

Cc'ing people from:
./scripts/get_maintainer.pl -f drivers/video/console/fbcon.c

Thanks,
Yong


-- 
Only stand for myself

^ permalink raw reply

* [PATCH] video via: fix iomem access
From: Stephen Hemminger @ 2011-03-03 17:59 UTC (permalink / raw)
  To: Florian Tobias Schandinat; +Cc: linux-fbdev, linux-kernel

This driver is not respecting the iomem memory space restrictions
and does direct access. This works on x86 but is non-portable and
should not be done.  Converted memcpy() of 2 to readw.
Last post increment of romptr was unnecessary since pointer never
used after that.

Found by sparse, compile tested only.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 drivers/video/via/lcd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/video/via/lcd.c	2011-03-03 09:09:10.552604209 -0800
+++ b/drivers/video/via/lcd.c	2011-03-03 09:56:12.144398571 -0800
@@ -1064,34 +1064,33 @@ static struct display_timing lcd_centeri
 
 bool viafb_lcd_get_mobile_state(bool *mobile)
 {
-	unsigned char *romptr, *tableptr;
+	unsigned char __iomem *romptr, *tableptr, *biosptr;
 	u8 core_base;
-	unsigned char *biosptr;
 	/* Rom address */
-	u32 romaddr = 0x000C0000;
-	u16 start_pattern = 0;
+	const u32 romaddr = 0x000C0000;
+	u16 start_pattern;
 
 	biosptr = ioremap(romaddr, 0x10000);
+	start_pattern = readw(biosptr);
 
-	memcpy(&start_pattern, biosptr, 2);
 	/* Compare pattern */
 	if (start_pattern = 0xAA55) {
 		/* Get the start of Table */
 		/* 0x1B means BIOS offset position */
 		romptr = biosptr + 0x1B;
-		tableptr = biosptr + *((u16 *) romptr);
+		tableptr = biosptr + readw(romptr);
 
 		/* Get the start of biosver structure */
 		/* 18 means BIOS version position. */
 		romptr = tableptr + 18;
-		romptr = biosptr + *((u16 *) romptr);
+		romptr = biosptr + readw(romptr);
 
 		/* The offset should be 44, but the
 		   actual image is less three char. */
 		/* pRom += 44; */
 		romptr += 41;
 
-		core_base = *romptr++;
+		core_base = readb(romptr);
 
 		if (core_base & 0x8)
 			*mobile = false;

^ permalink raw reply

* [PATCH] video via: make local variables static
From: Stephen Hemminger @ 2011-03-03 18:00 UTC (permalink / raw)
  To: linux-fbdev

Many local variables should be declared static.
Found by sparse, compile tested only.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---

 drivers/video/via/hw.c       |    2 
 drivers/video/via/lcd.c      |   10 ++--
 drivers/video/via/via_i2c.c  |    2 
 drivers/video/via/viafbdev.c |    6 +-
 drivers/video/via/viamode.c  |  100 +++++++++++++++++++++----------------------
 5 files changed, 61 insertions(+), 59 deletions(-)

--- a/drivers/video/via/lcd.c	2011-03-03 09:43:23.529389476 -0800
+++ b/drivers/video/via/lcd.c	2011-03-03 09:44:07.241570863 -0800
@@ -26,10 +26,12 @@
 
 /* CLE266 Software Power Sequence */
 /* {Mask}, {Data}, {Delay} */
-int PowerSequenceOn[3][3] = { {0x10, 0x08, 0x06}, {0x10, 0x08, 0x06},
-	{0x19, 0x1FE, 0x01} };
-int PowerSequenceOff[3][3] = { {0x06, 0x08, 0x10}, {0x00, 0x00, 0x00},
-	{0xD2, 0x19, 0x01} };
+static const int PowerSequenceOn[3][3] = {
+	{0x10, 0x08, 0x06}, {0x10, 0x08, 0x06},	{0x19, 0x1FE, 0x01}
+};
+static const int PowerSequenceOff[3][3] = {
+	{0x06, 0x08, 0x10}, {0x00, 0x00, 0x00},	{0xD2, 0x19, 0x01}
+};
 
 static struct _lcd_scaling_factor lcd_scaling_factor = {
 	/* LCD Horizontal Scaling Factor Register */
--- a/drivers/video/via/hw.c	2011-03-03 09:09:10.536603676 -0800
+++ b/drivers/video/via/hw.c	2011-03-03 09:44:07.241570863 -0800
@@ -751,7 +751,7 @@ void viafb_unlock_crt(void)
 	viafb_write_reg_mask(CR47, VIACR, 0, BIT0);
 }
 
-void write_dac_reg(u8 index, u8 r, u8 g, u8 b)
+static void write_dac_reg(u8 index, u8 r, u8 g, u8 b)
 {
 	outb(index, LUT_INDEX_WRITE);
 	outb(r, LUT_DATA);
--- a/drivers/video/via/via_i2c.c	2011-03-03 09:09:10.544604009 -0800
+++ b/drivers/video/via/via_i2c.c	2011-03-03 09:44:07.245570884 -0800
@@ -32,7 +32,7 @@
  */
 #define VIAFB_NUM_I2C		5
 static struct via_i2c_stuff via_i2c_par[VIAFB_NUM_I2C];
-struct viafb_dev *i2c_vdev;  /* Passed in from core */
+static struct viafb_dev *i2c_vdev;  /* Passed in from core */
 
 static void via_i2c_setscl(void *data, int state)
 {
--- a/drivers/video/via/viafbdev.c	2011-03-03 09:09:10.528603482 -0800
+++ b/drivers/video/via/viafbdev.c	2011-03-03 09:44:07.245570884 -0800
@@ -43,11 +43,11 @@ static int viafb_second_size;
 static int viafb_accel = 1;
 
 /* Added for specifying active devices.*/
-char *viafb_active_dev;
+static char *viafb_active_dev;
 
 /*Added for specify lcd output port*/
-char *viafb_lcd_port = "";
-char *viafb_dvi_port = "";
+static char *viafb_lcd_port = "";
+static char *viafb_dvi_port = "";
 
 static void retrieve_device_setting(struct viafb_ioctl_setting
 	*setting_info);
--- a/drivers/video/via/viamode.c	2011-03-03 09:45:33.462159061 -0800
+++ b/drivers/video/via/viamode.c	2011-03-03 09:46:28.826662504 -0800
@@ -443,7 +443,7 @@ struct VPITTable VPIT = {
 /********************/
 
 /* 480x640 */
-struct crt_mode_table CRTM480x640[] = {
+static struct crt_mode_table CRTM480x640[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_25_175M, M480X640_R60_HSP, M480X640_R60_VSP,
@@ -451,7 +451,7 @@ struct crt_mode_table CRTM480x640[] = {
 };
 
 /* 640x480*/
-struct crt_mode_table CRTM640x480[] = {
+static struct crt_mode_table CRTM640x480[] = {
 	/*r_rate,vclk,hsp,vsp */
 	/*HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_25_175M, M640X480_R60_HSP, M640X480_R60_VSP,
@@ -469,7 +469,7 @@ struct crt_mode_table CRTM640x480[] = {
 };
 
 /*720x480 (GTF)*/
-struct crt_mode_table CRTM720x480[] = {
+static struct crt_mode_table CRTM720x480[] = {
 	/*r_rate,vclk,hsp,vsp      */
 	/*HT, HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_26_880M, M720X480_R60_HSP, M720X480_R60_VSP,
@@ -478,7 +478,7 @@ struct crt_mode_table CRTM720x480[] = {
 };
 
 /*720x576 (GTF)*/
-struct crt_mode_table CRTM720x576[] = {
+static struct crt_mode_table CRTM720x576[] = {
 	/*r_rate,vclk,hsp,vsp */
 	/*HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_32_668M, M720X576_R60_HSP, M720X576_R60_VSP,
@@ -486,7 +486,7 @@ struct crt_mode_table CRTM720x576[] = {
 };
 
 /* 800x480 (CVT) */
-struct crt_mode_table CRTM800x480[] = {
+static struct crt_mode_table CRTM800x480[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_29_581M, M800X480_R60_HSP, M800X480_R60_VSP,
@@ -494,7 +494,7 @@ struct crt_mode_table CRTM800x480[] = {
 };
 
 /* 800x600*/
-struct crt_mode_table CRTM800x600[] = {
+static struct crt_mode_table CRTM800x600[] = {
 	/*r_rate,vclk,hsp,vsp     */
 	/*HT,   HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_40_000M, M800X600_R60_HSP, M800X600_R60_VSP,
@@ -512,7 +512,7 @@ struct crt_mode_table CRTM800x600[] = {
 };
 
 /* 848x480 (CVT) */
-struct crt_mode_table CRTM848x480[] = {
+static struct crt_mode_table CRTM848x480[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_31_500M, M848X480_R60_HSP, M848X480_R60_VSP,
@@ -520,7 +520,7 @@ struct crt_mode_table CRTM848x480[] = {
 };
 
 /*856x480 (GTF) convert to 852x480*/
-struct crt_mode_table CRTM852x480[] = {
+static struct crt_mode_table CRTM852x480[] = {
 	/*r_rate,vclk,hsp,vsp     */
 	/*HT,   HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_31_728M, M852X480_R60_HSP, M852X480_R60_VSP,
@@ -528,7 +528,7 @@ struct crt_mode_table CRTM852x480[] = {
 };
 
 /*1024x512 (GTF)*/
-struct crt_mode_table CRTM1024x512[] = {
+static struct crt_mode_table CRTM1024x512[] = {
 	/*r_rate,vclk,hsp,vsp     */
 	/*HT,   HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_41_291M, M1024X512_R60_HSP, M1024X512_R60_VSP,
@@ -537,7 +537,7 @@ struct crt_mode_table CRTM1024x512[] = {
 };
 
 /* 1024x600*/
-struct crt_mode_table CRTM1024x600[] = {
+static struct crt_mode_table CRTM1024x600[] = {
 	/*r_rate,vclk,hsp,vsp */
 	/*HT,  HA,   HBS,  HBE, HSS,  HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_48_875M, M1024X600_R60_HSP, M1024X600_R60_VSP,
@@ -545,7 +545,7 @@ struct crt_mode_table CRTM1024x600[] = {
 };
 
 /* 1024x768*/
-struct crt_mode_table CRTM1024x768[] = {
+static struct crt_mode_table CRTM1024x768[] = {
 	/*r_rate,vclk,hsp,vsp */
 	/*HT,  HA,   HBS,  HBE, HSS,  HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_65_000M, M1024X768_R60_HSP, M1024X768_R60_VSP,
@@ -559,7 +559,7 @@ struct crt_mode_table CRTM1024x768[] = {
 };
 
 /* 1152x864*/
-struct crt_mode_table CRTM1152x864[] = {
+static struct crt_mode_table CRTM1152x864[] = {
 	/*r_rate,vclk,hsp,vsp      */
 	/*HT,  HA,   HBS,  HBE, HSS,  HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_75, CLK_108_000M, M1152X864_R75_HSP, M1152X864_R75_VSP,
@@ -568,7 +568,7 @@ struct crt_mode_table CRTM1152x864[] = {
 };
 
 /* 1280x720 (HDMI 720P)*/
-struct crt_mode_table CRTM1280x720[] = {
+static struct crt_mode_table CRTM1280x720[] = {
 	/*r_rate,vclk,hsp,vsp */
 	/*HT,  HA,   HBS,  HBE, HSS,  HSE, VT,  VA,  VBS, VBE, VSS, VSE      */
 	{REFRESH_60, CLK_74_481M, M1280X720_R60_HSP, M1280X720_R60_VSP,
@@ -578,7 +578,7 @@ struct crt_mode_table CRTM1280x720[] = {
 };
 
 /*1280x768 (GTF)*/
-struct crt_mode_table CRTM1280x768[] = {
+static struct crt_mode_table CRTM1280x768[] = {
 	/*r_rate,vclk,hsp,vsp     */
 	/*HT,  HA,   HBS,  HBE, HSS,  HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_80_136M, M1280X768_R60_HSP, M1280X768_R60_VSP,
@@ -588,7 +588,7 @@ struct crt_mode_table CRTM1280x768[] = {
 };
 
 /* 1280x800 (CVT) */
-struct crt_mode_table CRTM1280x800[] = {
+static struct crt_mode_table CRTM1280x800[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_83_375M, M1280X800_R60_HSP, M1280X800_R60_VSP,
@@ -596,7 +596,7 @@ struct crt_mode_table CRTM1280x800[] = {
 };
 
 /*1280x960*/
-struct crt_mode_table CRTM1280x960[] = {
+static struct crt_mode_table CRTM1280x960[] = {
 	/*r_rate,vclk,hsp,vsp */
 	/*HT,  HA,   HBS,  HBE, HSS,  HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_108_000M, M1280X960_R60_HSP, M1280X960_R60_VSP,
@@ -604,7 +604,7 @@ struct crt_mode_table CRTM1280x960[] = {
 };
 
 /* 1280x1024*/
-struct crt_mode_table CRTM1280x1024[] = {
+static struct crt_mode_table CRTM1280x1024[] = {
 	/*r_rate,vclk,,hsp,vsp */
 	/*HT,  HA,   HBS,  HBE, HSS,  HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_108_000M, M1280X1024_R60_HSP, M1280X1024_R60_VSP,
@@ -618,7 +618,7 @@ struct crt_mode_table CRTM1280x1024[]  };
 
 /* 1368x768 (GTF) */
-struct crt_mode_table CRTM1368x768[] = {
+static struct crt_mode_table CRTM1368x768[] = {
 	/* r_rate,  vclk, hsp, vsp */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_85_860M, M1368X768_R60_HSP, M1368X768_R60_VSP,
@@ -626,7 +626,7 @@ struct crt_mode_table CRTM1368x768[] = {
 };
 
 /*1440x1050 (GTF)*/
-struct crt_mode_table CRTM1440x1050[] = {
+static struct crt_mode_table CRTM1440x1050[] = {
 	/*r_rate,vclk,hsp,vsp      */
 	/*HT,  HA,   HBS,  HBE, HSS,  HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_125_104M, M1440X1050_R60_HSP, M1440X1050_R60_VSP,
@@ -634,7 +634,7 @@ struct crt_mode_table CRTM1440x1050[]  };
 
 /* 1600x1200*/
-struct crt_mode_table CRTM1600x1200[] = {
+static struct crt_mode_table CRTM1600x1200[] = {
 	/*r_rate,vclk,hsp,vsp */
 	/*HT,  HA,   HBS,  HBE, HSS,  HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_162_000M, M1600X1200_R60_HSP, M1600X1200_R60_VSP,
@@ -646,7 +646,7 @@ struct crt_mode_table CRTM1600x1200[]  };
 
 /* 1680x1050 (CVT) */
-struct crt_mode_table CRTM1680x1050[] = {
+static struct crt_mode_table CRTM1680x1050[] = {
 	/* r_rate,          vclk,              hsp,             vsp  */
 	/* HT,  HA,  HBS, HBE, HSS, HSE,    VT,  VA,  VBS, VBE,  VSS, VSE */
 	{REFRESH_60, CLK_146_760M, M1680x1050_R60_HSP, M1680x1050_R60_VSP,
@@ -657,7 +657,7 @@ struct crt_mode_table CRTM1680x1050[]  };
 
 /* 1680x1050 (CVT Reduce Blanking) */
-struct crt_mode_table CRTM1680x1050_RB[] = {
+static struct crt_mode_table CRTM1680x1050_RB[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE,    VT,  VA,  VBS, VBE,  VSS, VSE */
 	{REFRESH_60, CLK_119_000M, M1680x1050_RB_R60_HSP,
@@ -666,7 +666,7 @@ struct crt_mode_table CRTM1680x1050_RB[]
 };
 
 /* 1920x1080 (CVT)*/
-struct crt_mode_table CRTM1920x1080[] = {
+static struct crt_mode_table CRTM1920x1080[] = {
 	/*r_rate,vclk,hsp,vsp */
 	/*HT,  HA,   HBS,  HBE, HSS,  HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_172_798M, M1920X1080_R60_HSP, M1920X1080_R60_VSP,
@@ -674,7 +674,7 @@ struct crt_mode_table CRTM1920x1080[]  };
 
 /* 1920x1080 (CVT with Reduce Blanking) */
-struct crt_mode_table CRTM1920x1080_RB[] = {
+static struct crt_mode_table CRTM1920x1080_RB[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_138_400M, M1920X1080_RB_R60_HSP,
@@ -683,7 +683,7 @@ struct crt_mode_table CRTM1920x1080_RB[]
 };
 
 /* 1920x1440*/
-struct crt_mode_table CRTM1920x1440[] = {
+static struct crt_mode_table CRTM1920x1440[] = {
 	/*r_rate,vclk,hsp,vsp */
 	/*HT,  HA,   HBS,  HBE, HSS,  HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_234_000M, M1920X1440_R60_HSP, M1920X1440_R60_VSP,
@@ -694,7 +694,7 @@ struct crt_mode_table CRTM1920x1440[]  };
 
 /* 1400x1050 (CVT) */
-struct crt_mode_table CRTM1400x1050[] = {
+static struct crt_mode_table CRTM1400x1050[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE,  HSS, HSE,   VT,  VA,  VBS, VBE,  VSS, VSE */
 	{REFRESH_60, CLK_121_750M, M1400X1050_R60_HSP, M1400X1050_R60_VSP,
@@ -705,7 +705,7 @@ struct crt_mode_table CRTM1400x1050[]  };
 
 /* 1400x1050 (CVT Reduce Blanking) */
-struct crt_mode_table CRTM1400x1050_RB[] = {
+static struct crt_mode_table CRTM1400x1050_RB[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE,  HSS, HSE,   VT,  VA,  VBS, VBE,  VSS, VSE */
 	{REFRESH_60, CLK_101_000M, M1400X1050_RB_R60_HSP,
@@ -714,7 +714,7 @@ struct crt_mode_table CRTM1400x1050_RB[]
 };
 
 /* 960x600 (CVT) */
-struct crt_mode_table CRTM960x600[] = {
+static struct crt_mode_table CRTM960x600[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_45_250M, M960X600_R60_HSP, M960X600_R60_VSP,
@@ -722,7 +722,7 @@ struct crt_mode_table CRTM960x600[] = {
 };
 
 /* 1000x600 (GTF) */
-struct crt_mode_table CRTM1000x600[] = {
+static struct crt_mode_table CRTM1000x600[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_48_000M, M1000X600_R60_HSP, M1000X600_R60_VSP,
@@ -730,7 +730,7 @@ struct crt_mode_table CRTM1000x600[] = {
 };
 
 /* 1024x576 (GTF) */
-struct crt_mode_table CRTM1024x576[] = {
+static struct crt_mode_table CRTM1024x576[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_46_996M, M1024X576_R60_HSP, M1024X576_R60_VSP,
@@ -738,7 +738,7 @@ struct crt_mode_table CRTM1024x576[] = {
 };
 
 /* 1088x612 (CVT) */
-struct crt_mode_table CRTM1088x612[] = {
+static struct crt_mode_table CRTM1088x612[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_52_977M, M1088X612_R60_HSP, M1088X612_R60_VSP,
@@ -746,7 +746,7 @@ struct crt_mode_table CRTM1088x612[] = {
 };
 
 /* 1152x720 (CVT) */
-struct crt_mode_table CRTM1152x720[] = {
+static struct crt_mode_table CRTM1152x720[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_66_750M, M1152X720_R60_HSP, M1152X720_R60_VSP,
@@ -754,7 +754,7 @@ struct crt_mode_table CRTM1152x720[] = {
 };
 
 /* 1200x720 (GTF) */
-struct crt_mode_table CRTM1200x720[] = {
+static struct crt_mode_table CRTM1200x720[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_70_159M, M1200X720_R60_HSP, M1200X720_R60_VSP,
@@ -762,7 +762,7 @@ struct crt_mode_table CRTM1200x720[] = {
 };
 
 /* 1200x900 (DCON) */
-struct crt_mode_table DCON1200x900[] = {
+static struct crt_mode_table DCON1200x900[] = {
 	/* r_rate,          vclk,               hsp,               vsp   */
 	{REFRESH_60, CLK_57_275M, M1200X900_R60_HSP, M1200X900_R60_VSP,
 	/* The correct htotal is 1240, but this doesn't raster on VX855. */
@@ -772,7 +772,7 @@ struct crt_mode_table DCON1200x900[] = {
 };
 
 /* 1280x600 (GTF) */
-struct crt_mode_table CRTM1280x600[] = {
+static struct crt_mode_table CRTM1280x600[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE,  HSS, HSE, VT,  VA,  VBS, VBE,  VSS, VSE */
 	{REFRESH_60, CLK_61_500M, M1280x600_R60_HSP, M1280x600_R60_VSP,
@@ -780,7 +780,7 @@ struct crt_mode_table CRTM1280x600[] = {
 };
 
 /* 1360x768 (CVT) */
-struct crt_mode_table CRTM1360x768[] = {
+static struct crt_mode_table CRTM1360x768[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_84_750M, M1360X768_R60_HSP, M1360X768_R60_VSP,
@@ -788,7 +788,7 @@ struct crt_mode_table CRTM1360x768[] = {
 };
 
 /* 1360x768 (CVT Reduce Blanking) */
-struct crt_mode_table CRTM1360x768_RB[] = {
+static struct crt_mode_table CRTM1360x768_RB[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_72_000M, M1360X768_RB_R60_HSP,
@@ -797,7 +797,7 @@ struct crt_mode_table CRTM1360x768_RB[]
 };
 
 /* 1366x768 (GTF) */
-struct crt_mode_table CRTM1366x768[] = {
+static struct crt_mode_table CRTM1366x768[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_85_860M, M1368X768_R60_HSP, M1368X768_R60_VSP,
@@ -807,7 +807,7 @@ struct crt_mode_table CRTM1366x768[] = {
 };
 
 /* 1440x900 (CVT) */
-struct crt_mode_table CRTM1440x900[] = {
+static struct crt_mode_table CRTM1440x900[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_106_500M, M1440X900_R60_HSP, M1440X900_R60_VSP,
@@ -817,7 +817,7 @@ struct crt_mode_table CRTM1440x900[] = {
 };
 
 /* 1440x900 (CVT Reduce Blanking) */
-struct crt_mode_table CRTM1440x900_RB[] = {
+static struct crt_mode_table CRTM1440x900_RB[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_88_750M, M1440X900_RB_R60_HSP,
@@ -826,7 +826,7 @@ struct crt_mode_table CRTM1440x900_RB[]
 };
 
 /* 1600x900 (CVT) */
-struct crt_mode_table CRTM1600x900[] = {
+static struct crt_mode_table CRTM1600x900[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_118_840M, M1600X900_R60_HSP, M1600X900_R60_VSP,
@@ -834,7 +834,7 @@ struct crt_mode_table CRTM1600x900[] = {
 };
 
 /* 1600x900 (CVT Reduce Blanking) */
-struct crt_mode_table CRTM1600x900_RB[] = {
+static struct crt_mode_table CRTM1600x900_RB[] = {
 	/* r_rate,        vclk,           hsp,        vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_97_750M, M1600X900_RB_R60_HSP,
@@ -843,7 +843,7 @@ struct crt_mode_table CRTM1600x900_RB[]
 };
 
 /* 1600x1024 (GTF) */
-struct crt_mode_table CRTM1600x1024[] = {
+static struct crt_mode_table CRTM1600x1024[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE,  HSS, HSE,   VT,  VA,  VBS, VBE,  VSS, VSE */
 	{REFRESH_60, CLK_136_700M, M1600X1024_R60_HSP, M1600X1024_R60_VSP,
@@ -851,7 +851,7 @@ struct crt_mode_table CRTM1600x1024[]  };
 
 /* 1792x1344 (DMT) */
-struct crt_mode_table CRTM1792x1344[] = {
+static struct crt_mode_table CRTM1792x1344[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE,  HSS, HSE,   VT,  VA,  VBS, VBE,  VSS, VSE */
 	{REFRESH_60, CLK_204_000M, M1792x1344_R60_HSP, M1792x1344_R60_VSP,
@@ -859,7 +859,7 @@ struct crt_mode_table CRTM1792x1344[]  };
 
 /* 1856x1392 (DMT) */
-struct crt_mode_table CRTM1856x1392[] = {
+static struct crt_mode_table CRTM1856x1392[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE,  HSS, HSE,   VT,  VA,  VBS, VBE,  VSS, VSE */
 	{REFRESH_60, CLK_218_500M, M1856x1392_R60_HSP, M1856x1392_R60_VSP,
@@ -867,7 +867,7 @@ struct crt_mode_table CRTM1856x1392[]  };
 
 /* 1920x1200 (CVT) */
-struct crt_mode_table CRTM1920x1200[] = {
+static struct crt_mode_table CRTM1920x1200[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_193_295M, M1920X1200_R60_HSP, M1920X1200_R60_VSP,
@@ -875,7 +875,7 @@ struct crt_mode_table CRTM1920x1200[]  };
 
 /* 1920x1200 (CVT with Reduce Blanking) */
-struct crt_mode_table CRTM1920x1200_RB[] = {
+static struct crt_mode_table CRTM1920x1200_RB[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE, HSS, HSE, VT,  VA,  VBS, VBE, VSS, VSE */
 	{REFRESH_60, CLK_153_920M, M1920X1200_RB_R60_HSP,
@@ -884,14 +884,14 @@ struct crt_mode_table CRTM1920x1200_RB[]
 };
 
 /* 2048x1536 (CVT) */
-struct crt_mode_table CRTM2048x1536[] = {
+static struct crt_mode_table CRTM2048x1536[] = {
 	/* r_rate,          vclk,              hsp,             vsp   */
 	/* HT,  HA,  HBS, HBE,  HSS, HSE,   VT,  VA,  VBS, VBE,  VSS, VSE */
 	{REFRESH_60, CLK_267_250M, M2048x1536_R60_HSP, M2048x1536_R60_VSP,
 	 {2800, 2048, 2048, 752, 2200, 224, 1592, 1536, 1536, 56, 1539, 4} }
 };
 
-struct VideoModeTable viafb_modes[] = {
+static struct VideoModeTable viafb_modes[] = {
 	/* Display : 480x640 (GTF) */
 	{CRTM480x640, ARRAY_SIZE(CRTM480x640)},
 
@@ -1016,7 +1016,7 @@ struct VideoModeTable viafb_modes[] = {
 	{CRTM1400x1050, ARRAY_SIZE(CRTM1400x1050)}
 };
 
-struct VideoModeTable viafb_rb_modes[] = {
+static struct VideoModeTable viafb_rb_modes[] = {
 	/* Display : 1360x768 (CVT Reduce Blanking) */
 	{CRTM1360x768_RB, ARRAY_SIZE(CRTM1360x768_RB)},
 

^ permalink raw reply

* [PATCH 2/2 v2] netlink: kill eff_cap from struct netlink_skb_parms
From: Chris Wright @ 2011-03-03 20:15 UTC (permalink / raw)
  To: David Miller
  Cc: chrisw, kaber, netdev, dm-devel, linux-security-module, drbd-dev,
	Evgeniy Polyakov, linux-fbdev
In-Reply-To: <20110303.105655.189705829.davem@davemloft.net>

* David Miller (davem@davemloft.net) wrote:
> From: Chris Wright <chrisw@sous-sol.org>
> Date: Thu, 3 Mar 2011 09:32:30 -0800
> 
> > * Patrick McHardy (kaber@trash.net) wrote:
> > 
> >> commit 8ff259625f0ab295fa085b0718eed13093813fbc
> >> Author: Patrick McHardy <kaber@trash.net>
> >> Date:   Thu Mar 3 10:17:31 2011 +0100
> >> 
> >>     netlink: kill eff_cap from struct netlink_skb_parms
> >>     
> >>     Netlink message processing in the kernel is synchronous these days,
> >>     capabilities can be checked directly in security_netlink_recv() from
> >>     the current process.
> >>     
> >>     Signed-off-by: Patrick McHardy <kaber@trash.net>
> > 
> > Thanks for doing that Patrick.  I looked at this earlier and thought
> > there was still an async path, but I guess that's just to another
> > userspace process.
> > 
> > BTW, I think you missed a couple connector based callers:
> > 
> > drivers/staging/pohmelfs/config.c:      if (!cap_raised(nsp->eff_cap, CAP_SYS_AD
> > drivers/video/uvesafb.c:        if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
> > 
> > Fix those and:
> > 
> > Acked-by: Chris Wright <chrisw@sous-sol.org>
> 
> Patrick, I'll apply your first patch, please respin this second patch with
> the changes mentioned here.

Here, I respun it so I could work on top of it

thanks,
-chris
---
From: Patrick McHardy <kaber@trash.net>
Subject: [PATCH 2/2 v2] netlink: kill eff_cap from struct netlink_skb_parms

Netlink message processing in the kernel is synchronous these days,
capabilities can be checked directly in security_netlink_recv() from
the current process.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Reviewed-by: James Morris <jmorris@namei.org>
[chrisw: update to include pohmelfs and uvesafb]
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---

I did not do exhaustive .config compile tests

 drivers/block/drbd/drbd_nl.c           |    2 +-
 drivers/md/dm-log-userspace-transfer.c |    2 +-
 drivers/staging/pohmelfs/config.c      |    2 +-
 drivers/video/uvesafb.c                |    2 +-
 include/linux/netlink.h                |    1 -
 net/netlink/af_netlink.c               |    6 ------
 security/commoncap.c                   |    3 +--
 7 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 8cbfaa6..fe81c85 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -2177,7 +2177,7 @@ static void drbd_connector_callback(struct cn_msg *req, struct netlink_skb_parms
 		return;
 	}
 
-	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN)) {
+	if (!cap_raised(current_cap(), CAP_SYS_ADMIN)) {
 		retcode = ERR_PERM;
 		goto fail;
 	}
diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c
index 049eaf1..1f23e04 100644
--- a/drivers/md/dm-log-userspace-transfer.c
+++ b/drivers/md/dm-log-userspace-transfer.c
@@ -134,7 +134,7 @@ static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 {
 	struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);
 
-	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
+	if (!cap_raised(current_cap(), CAP_SYS_ADMIN))
 		return;
 
 	spin_lock(&receiving_list_lock);
diff --git a/drivers/staging/pohmelfs/config.c b/drivers/staging/pohmelfs/config.c
index 89279ba..39413b7 100644
--- a/drivers/staging/pohmelfs/config.c
+++ b/drivers/staging/pohmelfs/config.c
@@ -525,7 +525,7 @@ static void pohmelfs_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *n
 {
 	int err;
 
-	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
+	if (!cap_raised(current_cap(), CAP_SYS_ADMIN))
 		return;
 
 	switch (msg->flags) {
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index 52ec095..5180a21 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -73,7 +73,7 @@ static void uvesafb_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *ns
 	struct uvesafb_task *utask;
 	struct uvesafb_ktask *task;
 
-	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
+	if (!cap_raised(current_cap(), CAP_SYS_ADMIN))
 		return;
 
 	if (msg->seq >= UVESAFB_TASKS_MAX)
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 66823b8..4c4ac3f 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -160,7 +160,6 @@ struct netlink_skb_parms {
 	struct ucred		creds;		/* Skb credentials	*/
 	__u32			pid;
 	__u32			dst_group;
-	kernel_cap_t		eff_cap;
 };
 
 #define NETLINK_CB(skb)		(*(struct netlink_skb_parms*)&((skb)->cb))
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 97ecd92..a808fb1 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1364,12 +1364,6 @@ static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,
 	NETLINK_CB(skb).dst_group = dst_group;
 	memcpy(NETLINK_CREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
 
-	/* What can I do? Netlink is asynchronous, so that
-	   we will have to save current capabilities to
-	   check them, when this message will be delivered
-	   to corresponding kernel module.   --ANK (980802)
-	 */
-
 	err = -EFAULT;
 	if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
 		kfree_skb(skb);
diff --git a/security/commoncap.c b/security/commoncap.c
index 64c2ed9..a83e607 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -52,13 +52,12 @@ static void warn_setuid_and_fcaps_mixed(const char *fname)
 
 int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
 {
-	NETLINK_CB(skb).eff_cap = current_cap();
 	return 0;
 }
 
 int cap_netlink_recv(struct sk_buff *skb, int cap)
 {
-	if (!cap_raised(NETLINK_CB(skb).eff_cap, cap))
+	if (!cap_raised(current_cap(), cap))
 		return -EPERM;
 	return 0;
 }
-- 
1.7.1


^ permalink raw reply related

* [RFC PATCH 3/2] security: update security_netlink_recv hook prototype
From: Chris Wright @ 2011-03-03 20:26 UTC (permalink / raw)
  To: James Morris, kaber
  Cc: David Miller, Chris Wright, netdev, dm-devel,
	linux-security-module, drbd-dev, Evgeniy Polyakov, linux-fbdev

We no longer need the skb in security_netlink_recv hook because the
netlink kernel receive path is synchronous.  There is no need to inspect
the netlink_skb_params.  Eliminating this makes it easy to reuse
the security_netlink_recv hook in connector callbacks.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
 drivers/scsi/scsi_netlink.c     |    2 +-
 include/linux/security.h        |   14 ++++++--------
 kernel/audit.c                  |    4 ++--
 net/core/rtnetlink.c            |    2 +-
 net/decnet/netfilter/dn_rtmsg.c |    2 +-
 net/ipv4/netfilter/ip_queue.c   |    2 +-
 net/ipv6/netfilter/ip6_queue.c  |    2 +-
 net/netfilter/nfnetlink.c       |    2 +-
 net/netlink/genetlink.c         |    2 +-
 net/xfrm/xfrm_user.c            |    2 +-
 security/commoncap.c            |    2 +-
 security/security.c             |    4 ++--
 security/selinux/hooks.c        |    4 ++--
 13 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c
index a2ed201..711bdc8 100644
--- a/drivers/scsi/scsi_netlink.c
+++ b/drivers/scsi/scsi_netlink.c
@@ -111,7 +111,7 @@ scsi_nl_rcv_msg(struct sk_buff *skb)
 			goto next_msg;
 		}
 
-		if (security_netlink_recv(skb, CAP_SYS_ADMIN)) {
+		if (security_netlink_recv(CAP_SYS_ADMIN)) {
 			err = -EPERM;
 			goto next_msg;
 		}
diff --git a/include/linux/security.h b/include/linux/security.h
index b2b7f97..8f10864 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -93,7 +93,7 @@ struct xfrm_user_sec_ctx;
 struct seq_file;
 
 extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
-extern int cap_netlink_recv(struct sk_buff *skb, int cap);
+extern int cap_netlink_recv(int cap);
 
 void reset_security_ops(void);
 
@@ -784,9 +784,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *	Return 0 if the information was successfully saved and message
  *	is allowed to be transmitted.
  * @netlink_recv:
- *	Check permission before processing the received netlink message in
- *	@skb.
- *	@skb contains the sk_buff structure for the netlink message.
+ *	Check permission before processing a received netlink message.
  *	@cap indicates the capability required
  *	Return 0 if permission is granted.
  *
@@ -1552,7 +1550,7 @@ struct security_operations {
 			  struct sembuf *sops, unsigned nsops, int alter);
 
 	int (*netlink_send) (struct sock *sk, struct sk_buff *skb);
-	int (*netlink_recv) (struct sk_buff *skb, int cap);
+	int (*netlink_recv) (int cap);
 
 	void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
 
@@ -1798,7 +1796,7 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode);
 int security_getprocattr(struct task_struct *p, char *name, char **value);
 int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
 int security_netlink_send(struct sock *sk, struct sk_buff *skb);
-int security_netlink_recv(struct sk_buff *skb, int cap);
+int security_netlink_recv(int cap);
 int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
 int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
 void security_release_secctx(char *secdata, u32 seclen);
@@ -2493,9 +2491,9 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
 	return cap_netlink_send(sk, skb);
 }
 
-static inline int security_netlink_recv(struct sk_buff *skb, int cap)
+static inline int security_netlink_recv(int cap)
 {
-	return cap_netlink_recv(skb, cap);
+	return cap_netlink_recv(cap);
 }
 
 static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
diff --git a/kernel/audit.c b/kernel/audit.c
index 608347c..ed43e46 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -596,13 +596,13 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)
 	case AUDIT_TTY_SET:
 	case AUDIT_TRIM:
 	case AUDIT_MAKE_EQUIV:
-		if (security_netlink_recv(skb, CAP_AUDIT_CONTROL))
+		if (security_netlink_recv(CAP_AUDIT_CONTROL))
 			err = -EPERM;
 		break;
 	case AUDIT_USER:
 	case AUDIT_FIRST_USER_MSG ... AUDIT_LAST_USER_MSG:
 	case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2:
-		if (security_netlink_recv(skb, CAP_AUDIT_WRITE))
+		if (security_netlink_recv(CAP_AUDIT_WRITE))
 			err = -EPERM;
 		break;
 	default:  /* bad msg */
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 2d65c6b..0d2dad5 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1819,7 +1819,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 	sz_idx = type>>2;
 	kind = type&3;
 
-	if (kind != 2 && security_netlink_recv(skb, CAP_NET_ADMIN))
+	if (kind != 2 && security_netlink_recv(CAP_NET_ADMIN))
 		return -EPERM;
 
 	if (kind = 2 && nlh->nlmsg_flags&NLM_F_DUMP) {
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c
index 64a7f39..51d9707 100644
--- a/net/decnet/netfilter/dn_rtmsg.c
+++ b/net/decnet/netfilter/dn_rtmsg.c
@@ -108,7 +108,7 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb)
 	if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
 		return;
 
-	if (security_netlink_recv(skb, CAP_NET_ADMIN))
+	if (security_netlink_recv(CAP_NET_ADMIN))
 		RCV_SKB_FAIL(-EPERM);
 
 	/* Eventually we might send routing messages too */
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index d2c1311..f821562 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -430,7 +430,7 @@ __ipq_rcv_skb(struct sk_buff *skb)
 	if (type <= IPQM_BASE)
 		return;
 
-	if (security_netlink_recv(skb, CAP_NET_ADMIN))
+	if (security_netlink_recv(CAP_NET_ADMIN))
 		RCV_SKB_FAIL(-EPERM);
 
 	spin_lock_bh(&queue_lock);
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 413ab07..f58cebb 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -431,7 +431,7 @@ __ipq_rcv_skb(struct sk_buff *skb)
 	if (type <= IPQM_BASE)
 		return;
 
-	if (security_netlink_recv(skb, CAP_NET_ADMIN))
+	if (security_netlink_recv(CAP_NET_ADMIN))
 		RCV_SKB_FAIL(-EPERM);
 
 	spin_lock_bh(&queue_lock);
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index b4a4532..caca5c6 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -130,7 +130,7 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 	const struct nfnetlink_subsystem *ss;
 	int type, err;
 
-	if (security_netlink_recv(skb, CAP_NET_ADMIN))
+	if (security_netlink_recv(CAP_NET_ADMIN))
 		return -EPERM;
 
 	/* All the messages must at least contain nfgenmsg */
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 1781d99..8c47d8f 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -516,7 +516,7 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 		return -EOPNOTSUPP;
 
 	if ((ops->flags & GENL_ADMIN_PERM) &&
-	    security_netlink_recv(skb, CAP_NET_ADMIN))
+	    security_netlink_recv(CAP_NET_ADMIN))
 		return -EPERM;
 
 	if (nlh->nlmsg_flags & NLM_F_DUMP) {
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 117a99e..5ad66bf 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2192,7 +2192,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 	link = &xfrm_dispatch[type];
 
 	/* All operations require privileges, even GET */
-	if (security_netlink_recv(skb, CAP_NET_ADMIN))
+	if (security_netlink_recv(CAP_NET_ADMIN))
 		return -EPERM;
 
 	if ((type = (XFRM_MSG_GETSA - XFRM_MSG_BASE) ||
diff --git a/security/commoncap.c b/security/commoncap.c
index a83e607..a9eefc9 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -55,7 +55,7 @@ int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
 	return 0;
 }
 
-int cap_netlink_recv(struct sk_buff *skb, int cap)
+int cap_netlink_recv(int cap)
 {
 	if (!cap_raised(current_cap(), cap))
 		return -EPERM;
diff --git a/security/security.c b/security/security.c
index 7b7308a..1e0879d 100644
--- a/security/security.c
+++ b/security/security.c
@@ -941,9 +941,9 @@ int security_netlink_send(struct sock *sk, struct sk_buff *skb)
 	return security_ops->netlink_send(sk, skb);
 }
 
-int security_netlink_recv(struct sk_buff *skb, int cap)
+int security_netlink_recv(int cap)
 {
-	return security_ops->netlink_recv(skb, cap);
+	return security_ops->netlink_recv(cap);
 }
 EXPORT_SYMBOL(security_netlink_recv);
 
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index cef42f5..a832d6b 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4665,13 +4665,13 @@ static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb)
 	return selinux_nlmsg_perm(sk, skb);
 }
 
-static int selinux_netlink_recv(struct sk_buff *skb, int capability)
+static int selinux_netlink_recv(int capability)
 {
 	int err;
 	struct common_audit_data ad;
 	u32 sid;
 
-	err = cap_netlink_recv(skb, capability);
+	err = cap_netlink_recv(capability);
 	if (err)
 		return err;
 
-- 
1.7.1


^ permalink raw reply related

* [RFC PATCH 4/2] connector: update callbacks to use
From: Chris Wright @ 2011-03-03 20:30 UTC (permalink / raw)
  To: James Morris, kaber
  Cc: David Miller, Chris Wright, netdev, dm-devel,
	linux-security-module, drbd-dev, Evgeniy Polyakov, linux-fbdev
In-Reply-To: <20110303202626.GV4988@sequoia.sous-sol.org>

This moves callbacks from a raw capabiliity hook to the generic lsm hook
when receiving request from userspace.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
 drivers/block/drbd/drbd_nl.c           |    2 +-
 drivers/md/dm-log-userspace-transfer.c |    2 +-
 drivers/staging/pohmelfs/config.c      |    2 +-
 drivers/video/uvesafb.c                |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index fe81c85..8b3301b 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -2177,7 +2177,7 @@ static void drbd_connector_callback(struct cn_msg *req, struct netlink_skb_parms
 		return;
 	}
 
-	if (!cap_raised(current_cap(), CAP_SYS_ADMIN)) {
+	if (security_netlink_recv(CAP_SYS_ADMIN)) {
 		retcode = ERR_PERM;
 		goto fail;
 	}
diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c
index 1f23e04..db34a3a 100644
--- a/drivers/md/dm-log-userspace-transfer.c
+++ b/drivers/md/dm-log-userspace-transfer.c
@@ -134,7 +134,7 @@ static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 {
 	struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);
 
-	if (!cap_raised(current_cap(), CAP_SYS_ADMIN))
+	if (security_netlink_recv(CAP_SYS_ADMIN))
 		return;
 
 	spin_lock(&receiving_list_lock);
diff --git a/drivers/staging/pohmelfs/config.c b/drivers/staging/pohmelfs/config.c
index 39413b7..123295a 100644
--- a/drivers/staging/pohmelfs/config.c
+++ b/drivers/staging/pohmelfs/config.c
@@ -525,7 +525,7 @@ static void pohmelfs_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *n
 {
 	int err;
 
-	if (!cap_raised(current_cap(), CAP_SYS_ADMIN))
+	if (security_netlink_recv(CAP_SYS_ADMIN))
 		return;
 
 	switch (msg->flags) {
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index 5180a21..081463a 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -73,7 +73,7 @@ static void uvesafb_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *ns
 	struct uvesafb_task *utask;
 	struct uvesafb_ktask *task;
 
-	if (!cap_raised(current_cap(), CAP_SYS_ADMIN))
+	if (security_netlink_recv(CAP_SYS_ADMIN))
 		return;
 
 	if (msg->seq >= UVESAFB_TASKS_MAX)
-- 
1.7.1

^ permalink raw reply related

* Re: [PATCH 2/2 v2] netlink: kill eff_cap from struct
From: David Miller @ 2011-03-03 21:39 UTC (permalink / raw)
  To: chrisw
  Cc: kaber, netdev, dm-devel, linux-security-module, drbd-dev, zbr,
	linux-fbdev
In-Reply-To: <20110303201522.GT4988@sequoia.sous-sol.org>

From: Chris Wright <chrisw@sous-sol.org>
Date: Thu, 3 Mar 2011 12:15:22 -0800

> Here, I respun it so I could work on top of it
 ...
> I did not do exhaustive .config compile tests

Thanks a lot Chris, applied.

^ permalink raw reply

* Re: [Drbd-dev] [PATCH 2/2 v2] netlink: kill eff_cap from struct
From: Lars Ellenberg @ 2011-03-03 22:37 UTC (permalink / raw)
  To: Chris Wright
  Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-security-module-u79uwXL29TY76Z2rM5mHXA,
	kaber-dcUjhNyLwpNeoWH0uzbU5w, dm-devel-H+wXaHxf7aLQT0dZR+AlfA,
	Evgeniy Polyakov, David Miller, drbd-dev-cunTk1MwBs8qoQakbn7OcQ
In-Reply-To: <20110303201522.GT4988-JyIX8gxvWYPr2PDY2+4mTGD2FQJk+8+b@public.gmane.org>

On Thu, Mar 03, 2011 at 12:15:22PM -0800, Chris Wright wrote:
> * David Miller (davem@davemloft.net) wrote:
> > From: Chris Wright <chrisw@sous-sol.org>
> > Date: Thu, 3 Mar 2011 09:32:30 -0800
> > 
> > > * Patrick McHardy (kaber@trash.net) wrote:
> > > 
> > >> commit 8ff259625f0ab295fa085b0718eed13093813fbc
> > >> Author: Patrick McHardy <kaber@trash.net>
> > >> Date:   Thu Mar 3 10:17:31 2011 +0100
> > >> 
> > >>     netlink: kill eff_cap from struct netlink_skb_parms
> > >>     
> > >>     Netlink message processing in the kernel is synchronous these days,
> > >>     capabilities can be checked directly in security_netlink_recv() from
> > >>     the current process.
> > >>     
> > >>     Signed-off-by: Patrick McHardy <kaber@trash.net>
> > > 
> > > Thanks for doing that Patrick.  I looked at this earlier and thought
> > > there was still an async path, but I guess that's just to another
> > > userspace process.
> > > 
> > > BTW, I think you missed a couple connector based callers:
> > > 
> > > drivers/staging/pohmelfs/config.c:      if (!cap_raised(nsp->eff_cap, CAP_SYS_AD
> > > drivers/video/uvesafb.c:        if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))


Last time I checked, current() for connector based netlink message
consumers was the work queue that is used for connector.

So unless that changed, or my understanding is wrong, current_cap()
inside cn_queue_wrapper(), respectively the d->callback()
will not be the userland sender process' capabilities, but the work
queue capabilities.

If so, then this change introduces the possibility for normal users to
send privileged commands to connector based subsystems, even if they
may not be able to bind() to suitable sockets to receive any replies.

Am I missing something?

	Lars

^ permalink raw reply

* Re: [Drbd-dev] [PATCH 2/2 v2] netlink: kill eff_cap from struct
From: Chris Wright @ 2011-03-03 23:53 UTC (permalink / raw)
  To: Chris Wright, David Miller, linux-fbdev, netdev,
	linux-security-module, dm-devel
In-Reply-To: <20110303223746.GI25069@barkeeper1-xen.linbit>

* Lars Ellenberg (lars.ellenberg@linbit.com) wrote:
> Last time I checked, current() for connector based netlink message
> consumers was the work queue that is used for connector.
> 
> So unless that changed, or my understanding is wrong, current_cap()
> inside cn_queue_wrapper(), respectively the d->callback()
> will not be the userland sender process' capabilities, but the work
> queue capabilities.

Yes, you're right.

> If so, then this change introduces the possibility for normal users to
> send privileged commands to connector based subsystems, even if they
> may not be able to bind() to suitable sockets to receive any replies.
> 
> Am I missing something?

No, thanks for review.  This puts back the async issue.

^ permalink raw reply

* Re: [Drbd-dev] [PATCH 2/2 v2] netlink: kill eff_cap from struct
From: Evgeniy Polyakov @ 2011-03-04  1:29 UTC (permalink / raw)
  To: Chris Wright, David Miller, linux-fbdev, netdev,
	linux-security-module, dm-devel
In-Reply-To: <20110303223746.GI25069@barkeeper1-xen.linbit>

Hi.

On Thu, Mar 03, 2011 at 11:37:46PM +0100, Lars Ellenberg (lars.ellenberg@linbit.com) wrote:
> If so, then this change introduces the possibility for normal users to
> send privileged commands to connector based subsystems, even if they
> may not be able to bind() to suitable sockets to receive any replies.
> 
> Am I missing something?

Yup, connector is very async at that place, but I wonder why the hell I
ever made that decision. I believe we can replace it with pure sync call
of the registered connector callback, since netlink is synchronous and
no one has any problem with it.

-- 
	Evgeniy Polyakov

^ permalink raw reply

* Re: [Drbd-dev] [PATCH 2/2 v2] netlink: kill eff_cap from struct
From: David Miller @ 2011-03-04  1:38 UTC (permalink / raw)
  To: zbr
  Cc: chrisw, linux-fbdev, netdev, linux-security-module, dm-devel,
	kaber, drbd-dev
In-Reply-To: <20110304012956.GA13573@ioremap.net>

From: Evgeniy Polyakov <zbr@ioremap.net>
Date: Fri, 4 Mar 2011 04:29:56 +0300

> Hi.
> 
> On Thu, Mar 03, 2011 at 11:37:46PM +0100, Lars Ellenberg (lars.ellenberg@linbit.com) wrote:
>> If so, then this change introduces the possibility for normal users to
>> send privileged commands to connector based subsystems, even if they
>> may not be able to bind() to suitable sockets to receive any replies.
>> 
>> Am I missing something?
> 
> Yup, connector is very async at that place, but I wonder why the hell I
> ever made that decision. I believe we can replace it with pure sync call
> of the registered connector callback, since netlink is synchronous and
> no one has any problem with it.

Yes, please it would really help us with what we're trying to do here.

^ permalink raw reply

* Re: [PATCH 0/2] add Samsung SoC based MIPI-DSI support.
From: InKi Dae @ 2011-03-04  4:19 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <4D244884.70204@samsung.com>

Hello, Mr. Kukjin.

how are you doing on these patches below?

with previous call, you said that they have no problem.
so please, apply them below to your samsung git.

thank you.

2011/1/5 daeinki <inki.dae@samsung.com>:
> Hello, all.
>
> S5PC110 and S5PC210 SoC platform have one or two MIPI-DSI controller.
> MIPI-DSI controller can be used to connect MIPI-DSI based LCD Panel.
> this patch adds MIPI-DSI controller driver.
>
> to use this driver, MIPI-DSI based LCD panel driver have to register
> mipi_dsim_lcd_driver object to MIPI-DSI driver and then when MIPI-DSI
> driver is probed, probe callback of LCD panel driver registered would be
> called.
>
> this patch includes just only MIPI-DSI driver because now mainline
> kernel has no any machine support with MIPI-DSI based LCD panel so this
> driver has been tested locally. I will have patch work for it and send
> it including machine specific codes in the future.
>
> The patch series contains:
>
> [PATCH 1/2] s5pc110: add clock gate for MIPI-DSI controller.
> [PATCH 2/2] s5pc110: add MIPI-DSI controller driver.
>
> thank you.
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

^ permalink raw reply

* [PATCH v2] matroxfb: remove incorrect Matrox G200eV support
From: Darrick J. Wong @ 2011-03-04 20:29 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Gary Hade, linux-fbdev, linux-kernel, Krzysztof Helt,
	Petr Vandrovec, Andrew Morton
In-Reply-To: <AANLkTikwSXN8VgDaoUqfHcxoTNxW9uA4D2fUtRLuLbHo@mail.gmail.com>

On Tue, Mar 01, 2011 at 10:29:23AM -0800, Linus Torvalds wrote:
> On Tue, Mar 1, 2011 at 9:50 AM, Gary Hade <garyhade@us.ibm.com> wrote:
> >
> > Remove incorrect Matrox G200eV support that was previously added
> > by commit e3a1938805d2e81b27d3d348788644f3bad004f2
> 
> That commit goes back to 2.6.28 (and is dated Oct 2008).
> 
> That means that you really need to describe the problem more:
> 
> > One serious issue with the G200eV support that I have reproduced
> > on a Matrox G200eV equipped IBM x3650 M2 is the lack of text (login
> > banner, login prompt, etc) on the console when X not running and
> > lack of text on all of the virtual consoles after X is started.

On an IBM x3650m2, loading the matroxfb-base fb driver for the builtin Matrox
G200eV VGA chip results in no usable analog signal coming out of the VGA port.
I noticed the "outputs=" parameter to that driver, and forced all outputs on;
when I did that, the display showed a crazed jumble of static and powered off.
The display would not power on again until I removed and reinserted the power
plug.  Other displays reacted less violently but not functionally, either.

> .. but without the commit, you get no fb at all, right? So even with
> the commit, at worst you'd just be able to not use the matroxfb
> driver, right?

Yep.  We contacted Matrox to see if they would help us sort out the output
misprogramming issue, and they declined.  Evidently they're no longer
interested in matroxfb support.

> What I'm trying to say is that I suspect there are G200eV users that
> likely prefer having the support in - even though it's not perfect.
> And the fact that the commit has been there for 2.5 years without
> comments makes me very loath to just revert it.

This is all quite strange -- 2.5 years ago when I wrote the patch it seemed to
work ok.  On newer revisions of the x3650M2 it seems broken.  The original
machine I wrote it for was cut up ages ago.

I suppose we could simply blacklist any G200eV with a subsystem vendor ID of
0x1014 (IBM) until we figure out how to correct the driver.  Our customers will
be deprived, but as it seems to be broken across most of our product lines I
doubt any of them are making serious use of it anyway. :)

Something like this?
--
matroxfb: Blacklist IBM G200eV chips

On an IBM x3650m2, loading the matroxfb-base fb driver for the builtin Matrox
G200eV VGA chip results in no usable analog signal coming out of the VGA port.
I noticed the "outputs=" parameter to that driver, and forced all outputs on;
when I did that, the display showed a crazed jumble of static and powered off.
The display would not power on again until I removed and reinserted the power
plug.  Other displays reacted less violently but not functionally, either.

For now, don't talk to the G200eV if it has an IBM subvendor ID.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---

 drivers/video/matrox/matroxfb_base.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c
index a082deb..a86e401 100644
--- a/drivers/video/matrox/matroxfb_base.c
+++ b/drivers/video/matrox/matroxfb_base.c
@@ -1385,6 +1385,17 @@ static struct video_board vbG400		= {0x2000000, 0x1000000, FB_ACCEL_MATROX_MGAG4
 #define DEVF_G450	(DEVF_GCORE | DEVF_ANY_VXRES | DEVF_SUPPORT32MB | DEVF_TEXT16B | DEVF_CRTC2 | DEVF_G450DAC | DEVF_SRCORG | DEVF_DUALHEAD)
 #define DEVF_G550	(DEVF_G450)
 
+static struct blacklisted_board {
+	unsigned short vendor, device, svid, sid;
+		} black_list[] = {
+#ifdef CONFIG_FB_MATROX_G
+	/* Onboard G200eV in IBM servers cause display failures */
+	{PCI_VENDOR_ID_MATROX,	PCI_DEVICE_ID_MATROX_G200EV_PCI,
+	 PCI_VENDOR_ID_IBM, 0},
+#endif
+	{0, 0, 0, 0},
+};
+
 static struct board {
 	unsigned short vendor, device, rev, svid, sid;
 	unsigned int flags;
@@ -2012,10 +2023,11 @@ static void matroxfb_unregister_device(struct matrox_fb_info* minfo) {
 
 static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dummy) {
 	struct board* b;
+	struct blacklisted_board *d;
 	u_int16_t svid;
 	u_int16_t sid;
 	struct matrox_fb_info* minfo;
-	int err;
+	int err, ignore;
 	u_int32_t cmd;
 	DBG(__func__)
 
@@ -2025,6 +2037,17 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm
 		if ((b->vendor != pdev->vendor) || (b->device != pdev->device) || (b->rev < pdev->revision)) continue;
 		if (b->svid)
 			if ((b->svid != svid) || (b->sid != sid)) continue;
+		ignore = 0;
+		for (d = black_list; d->vendor; d++)
+			if (d->vendor = pdev->vendor &&
+			    d->device = pdev->device &&
+			    d->svid = svid &&
+			    (!d->sid || d->sid = sid)) {
+				ignore = 1;
+				break;
+			}
+		if (ignore)
+			continue;
 		break;
 	}
 	/* not match... */

^ permalink raw reply related

* Re: [PATCH 3/4] [ARM] msm_fb: Fix framebuffer console
From: Arve Hjønnevåg @ 2011-03-04 23:03 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <9d6dd47e36dafad4e2f876d994f607e2.squirrel@www.codeaurora.org>

On Wed, Mar 2, 2011 at 1:26 PM, Carl Vanderlip <carlv@codeaurora.org> wrote:
> On Wed, 2011-03-02 at 13:17 -0800, Carl Vanderlip wrote:
>> From: Arve Hjønnevåg <arve@android.com>
>>
>> Don't allow non panning updates to bypass the wait for the panel to turn
> on.
>>
>> Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
>
> Arve,
>
>        This patch did not have a SOB from you. Would you sign off on this patch?
>

Yes, you can add a sign-off and/or ack by me.

-- 
Arve Hjønnevåg

^ permalink raw reply

* [PATCH] video: pwm_backlight: Add check_fb hook
From: Robert Morell @ 2011-03-05  1:08 UTC (permalink / raw)
  To: Richard Purdie, Arun Murthy, Andrew Morton, Linus Walleij
  Cc: linux-fbdev, linux-kernel, Robert Morell

In systems with multiple framebuffer devices, one of the devices might
be blanked while another is unblanked.  In order for the backlight
blanking logic to know whether to turn off the backlight for a
particular framebuffer's blanking notification, it needs to be able to
check if a given framebuffer device corresponds to the backlight.

This plumbs the check_fb hook from core backlight through the
pwm_backlight helper to allow platform code to plug in a check_fb hook.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
---
 drivers/video/backlight/pwm_bl.c |   11 +++++++++++
 include/linux/pwm_backlight.h    |    3 +++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 21866ec..0f2c131 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -28,6 +28,7 @@ struct pwm_bl_data {
 	unsigned int		lth_brightness;
 	int			(*notify)(struct device *,
 					  int brightness);
+	int			(*check_fb)(struct device *, struct fb_info *);
 };
 
 static int pwm_backlight_update_status(struct backlight_device *bl)
@@ -62,9 +63,18 @@ static int pwm_backlight_get_brightness(struct backlight_device *bl)
 	return bl->props.brightness;
 }
 
+static int pwm_backlight_check_fb(struct backlight_device *bl,
+				  struct fb_info *info)
+{
+	struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
+
+	return !pb->check_fb || pb->check_fb(pb->dev, info);
+}
+
 static const struct backlight_ops pwm_backlight_ops = {
 	.update_status	= pwm_backlight_update_status,
 	.get_brightness	= pwm_backlight_get_brightness,
+	.check_fb	= pwm_backlight_check_fb,
 };
 
 static int pwm_backlight_probe(struct platform_device *pdev)
@@ -95,6 +105,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 
 	pb->period = data->pwm_period_ns;
 	pb->notify = data->notify;
+	pb->check_fb = data->check_fb;
 	pb->lth_brightness = data->lth_brightness *
 		(data->pwm_period_ns / data->max_brightness);
 	pb->dev = &pdev->dev;
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index e031e1a..5e3e25a 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -4,6 +4,8 @@
 #ifndef __LINUX_PWM_BACKLIGHT_H
 #define __LINUX_PWM_BACKLIGHT_H
 
+#include <linux/backlight.h>
+
 struct platform_pwm_backlight_data {
 	int pwm_id;
 	unsigned int max_brightness;
@@ -13,6 +15,7 @@ struct platform_pwm_backlight_data {
 	int (*init)(struct device *dev);
 	int (*notify)(struct device *dev, int brightness);
 	void (*exit)(struct device *dev);
+	int (*check_fb)(struct device *dev, struct fb_info *info);
 };
 
 #endif
-- 
1.7.3.4


^ permalink raw reply related

* Re: [PATCH v2 1/3] ARM: PXA: PXAFB: Fix double-free issue
From: Vasily Khoruzhick @ 2011-03-05 22:30 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1298214147-11578-1-git-send-email-anarsoul@gmail.com>

Please discard this series.

PXA270/3xx overlay memory management is still broken - it was not good 
decision to allocate memory on open/close - after some time OS just does not 
have 115kb of contiguous memory, so it fails to allocate overlay fb memory 
after ~1h of uptime.

I'll rework it and resend soon.

Regards
Vasily

^ permalink raw reply

* [PATCH] video: add MODULE_DEVICE_TABLE
From: Axel Lin @ 2011-03-07  8:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ghozlane Toumi, David S. Miller, Alan Hourihane, Paul Mundt,
	linux-fbdev

The device table is required to load modules based on modaliases.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Ghozlane Toumi <gtoumi@laposte.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: Alan Hourihane <alanh@tungstengraphics.com>
---
 drivers/video/sstfb.c               |    1 +
 drivers/video/sunxvr2500.c          |    1 +
 drivers/video/sunxvr500.c           |    1 +
 drivers/video/vermilion/vermilion.c |    1 +
 4 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c
index 2ab7041..597e80b 100644
--- a/drivers/video/sstfb.c
+++ b/drivers/video/sstfb.c
@@ -1485,6 +1485,7 @@ static const struct pci_device_id sstfb_id_tbl[] = {
 		.driver_data = ID_VOODOO2, },
 	{ 0 },
 };
+MODULE_DEVICE_TABLE(pci, sstfb_id_tbl);
 
 static struct pci_driver sstfb_driver = {
 	.name		= "sstfb",
diff --git a/drivers/video/sunxvr2500.c b/drivers/video/sunxvr2500.c
index 5848436..a83bc42 100644
--- a/drivers/video/sunxvr2500.c
+++ b/drivers/video/sunxvr2500.c
@@ -244,6 +244,7 @@ static struct pci_device_id s3d_pci_table[] = {
 	{	PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x0033),	},
 	{ 0, }
 };
+MODULE_DEVICE_TABLE(pci, s3d_pci_table);
 
 static struct pci_driver s3d_driver = {
 	.name		= "s3d",
diff --git a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c
index b9c2b94..19e0395 100644
--- a/drivers/video/sunxvr500.c
+++ b/drivers/video/sunxvr500.c
@@ -428,6 +428,7 @@ static struct pci_device_id e3d_pci_table[] = {
 	},
 	{ 0, }
 };
+MODULE_DEVICE_TABLE(pci, e3d_pci_table);
 
 static struct pci_driver e3d_driver = {
 	.name		= "e3d",
diff --git a/drivers/video/vermilion/vermilion.c b/drivers/video/vermilion/vermilion.c
index 931a567..30bd156 100644
--- a/drivers/video/vermilion/vermilion.c
+++ b/drivers/video/vermilion/vermilion.c
@@ -1057,6 +1057,7 @@ static struct pci_device_id vml_ids[] = {
 	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, VML_DEVICE_VDC)},
 	{0}
 };
+MODULE_DEVICE_TABLE(pci, vml_ids);
 
 static struct pci_driver vmlfb_pci_driver = {
 	.name = "vmlfb",
-- 
1.7.2




^ permalink raw reply related

* Re: [PATCH v2] matroxfb: remove incorrect Matrox G200eV support
From: Benjamin Herrenschmidt @ 2011-03-07  8:59 UTC (permalink / raw)
  To: djwong
  Cc: Linus Torvalds, Gary Hade, linux-fbdev, linux-kernel,
	Krzysztof Helt, Petr Vandrovec, Andrew Morton
In-Reply-To: <20110304202905.GB27190@tux1.beaverton.ibm.com>

On Fri, 2011-03-04 at 12:29 -0800, Darrick J. Wong wrote:
> This is all quite strange -- 2.5 years ago when I wrote the patch it
> seemed to
> work ok.  On newer revisions of the x3650M2 it seems broken.  The
> original
> machine I wrote it for was cut up ages ago.
> 
> I suppose we could simply blacklist any G200eV with a subsystem vendor
> ID of
> 0x1014 (IBM) until we figure out how to correct the driver.  Our
> customers will
> be deprived, but as it seems to be broken across most of our product
> lines I
> doubt any of them are making serious use of it anyway. :)
> 
> Something like this? 

Does X work with the open source drivers ? In that case a better
approach would be to try to figure out what's different between the way
the 2 drivers setup the card registers and fix matroxfb..

Cheers,
Ben.



^ permalink raw reply

* Re: [PATCH] video: add MODULE_DEVICE_TABLE
From: Alan Cox @ 2011-03-07 10:31 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Ghozlane Toumi, David S. Miller, Alan Hourihane,
	Paul Mundt, linux-fbdev
In-Reply-To: <1299486373.20702.1.camel@mola>

On Mon, 07 Mar 2011 16:26:13 +0800
Axel Lin <axel.lin@gmail.com> wrote:

> The device table is required to load modules based on modaliases.

Doing this then triggers autoloading which for some of these drivers is
the wrong thing.

> diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c
> index 2ab7041..597e80b 100644
> --- a/drivers/video/sstfb.c
> +++ b/drivers/video/sstfb.c
> @@ -1485,6 +1485,7 @@ static const struct pci_device_id sstfb_id_tbl[] = {
>  		.driver_data = ID_VOODOO2, },
>  	{ 0 },
>  };
> +MODULE_DEVICE_TABLE(pci, sstfb_id_tbl);

NAK - as things stand in the frame buffer world you don't want sstfb
autoloading and stealing your main framebuffer away.


^ permalink raw reply

* Re: [Drbd-dev] [PATCH 2/2 v2] netlink: kill eff_cap from struct netlink_skb_parms
From: Patrick McHardy @ 2011-03-08 14:50 UTC (permalink / raw)
  To: Evgeniy Polyakov
  Cc: Chris Wright, David Miller, linux-fbdev, netdev,
	linux-security-module, dm-devel, drbd-dev
In-Reply-To: <20110304012956.GA13573@ioremap.net>

Am 04.03.2011 02:29, schrieb Evgeniy Polyakov:
> Hi.
> 
> On Thu, Mar 03, 2011 at 11:37:46PM +0100, Lars Ellenberg (lars.ellenberg@linbit.com) wrote:
>> If so, then this change introduces the possibility for normal users to
>> send privileged commands to connector based subsystems, even if they
>> may not be able to bind() to suitable sockets to receive any replies.
>>
>> Am I missing something?
> 
> Yup, connector is very async at that place, but I wonder why the hell I
> ever made that decision. I believe we can replace it with pure sync call
> of the registered connector callback, since netlink is synchronous and
> no one has any problem with it.
> 

Are you going to do this or do you want me to take care of it?

^ permalink raw reply

* Re: [Drbd-dev] [PATCH 2/2 v2] netlink: kill eff_cap from struct
From: Evgeniy Polyakov @ 2011-03-08 18:32 UTC (permalink / raw)
  To: Patrick McHardy
  Cc: Chris Wright, David Miller, linux-fbdev, netdev,
	linux-security-module, dm-devel, drbd-dev
In-Reply-To: <4D764247.9080509@trash.net>

Hi Patrick.

On Tue, Mar 08, 2011 at 03:50:47PM +0100, Patrick McHardy (kaber@trash.net) wrote:
> > Yup, connector is very async at that place, but I wonder why the hell I
> > ever made that decision. I believe we can replace it with pure sync call
> > of the registered connector callback, since netlink is synchronous and
> > no one has any problem with it.
> 
> Are you going to do this or do you want me to take care of it?

I will return back at the end of the week and will take care of this
problem. I will not mind if you complete it first though :)

-- 
	Evgeniy Polyakov

^ permalink raw reply

* Re: [Drbd-dev] [PATCH 2/2 v2] netlink: kill eff_cap from struct netlink_skb_parms
From: Patrick McHardy @ 2011-03-08 18:54 UTC (permalink / raw)
  To: Evgeniy Polyakov
  Cc: Chris Wright, David Miller, linux-fbdev, netdev,
	linux-security-module, dm-devel, drbd-dev
In-Reply-To: <20110308183246.GA17412@ioremap.net>

Am 08.03.2011 19:32, schrieb Evgeniy Polyakov:
> Hi Patrick.
> 
> On Tue, Mar 08, 2011 at 03:50:47PM +0100, Patrick McHardy (kaber@trash.net) wrote:
>>> Yup, connector is very async at that place, but I wonder why the hell I
>>> ever made that decision. I believe we can replace it with pure sync call
>>> of the registered connector callback, since netlink is synchronous and
>>> no one has any problem with it.
>>
>> Are you going to do this or do you want me to take care of it?
> 
> I will return back at the end of the week and will take care of this
> problem. I will not mind if you complete it first though :)

Thanks Evgeniy, I'll give it a shot.

^ permalink raw reply

* [PATCH 0/6] OMAP: DSS2: DSI: IRQ restructuring
From: Tomi Valkeinen @ 2011-03-09  7:21 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen

Hi,

In the future we will have more features using the DSI interrupts, like ULPS
handling, and making use-case specific hooks into the main IRQ handler would
become burdensome.

This patch set cleans up the DSI IRQ handling a bit by implementing a generic
way to register/unregister interrupt service routines. This allows us to remove
the use-case specific callbacks from the main IRQ handler.

 Tomi

Tomi Valkeinen (6):
  OMAP: DSS2: DSI: Restructure IRQ handler
  OMAP: DSS2: DSI: Add ISR support
  OMAP: DSS2: DSI: use ISR in send_bta_sync
  OMAP: DSS2: DSI: use ISR for BTA in framedone
  OMAP: DSS2: DSI: catch DSI errors in send_bta_sync
  OMAP: DSS2: DSI: fix IRQ debug prints

 drivers/video/omap2/dss/dsi.c |  523 ++++++++++++++++++++++++++++++++---------
 1 files changed, 408 insertions(+), 115 deletions(-)


^ permalink raw reply

* [PATCH 1/6] OMAP: DSS2: DSI: Restructure IRQ handler
From: Tomi Valkeinen @ 2011-03-09  7:21 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1299655288-7121-1-git-send-email-tomi.valkeinen@ti.com>

Clean up the IRQ handler a bit by separating collection of IRQ stats and
handling of IRQ errors to separate functions.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dsi.c |  123 ++++++++++++++++++++++++-----------------
 1 files changed, 73 insertions(+), 50 deletions(-)

diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index be7694f..a0881da 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -480,26 +480,33 @@ static void print_irq_status_cio(u32 status)
 	printk("\n");
 }
 
-static int debug_irq;
-
-/* called from dss */
-static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
+#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
+static void dsi_collect_irq_stats(u32 irqstatus, u32 *vcstatus, u32 ciostatus)
 {
-	u32 irqstatus, vcstatus, ciostatus;
 	int i;
 
-	irqstatus = dsi_read_reg(DSI_IRQSTATUS);
-
-	/* IRQ is not for us */
-	if (!irqstatus)
-		return IRQ_NONE;
-
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
 	spin_lock(&dsi.irq_stats_lock);
+
 	dsi.irq_stats.irq_count++;
 	dss_collect_irq_stats(irqstatus, dsi.irq_stats.dsi_irqs);
+
+	for (i = 0; i < 4; ++i)
+		dss_collect_irq_stats(vcstatus[i], dsi.irq_stats.vc_irqs[i]);
+
+	dss_collect_irq_stats(ciostatus, dsi.irq_stats.cio_irqs);
+
+	spin_unlock(&dsi.irq_stats_lock);
+}
+#else
+#define dsi_collect_irq_stats(irqstatus, vcstatus, ciostatus)
 #endif
 
+static int debug_irq;
+
+static void dsi_handle_irq_errors(u32 irqstatus, u32 *vcstatus, u32 ciostatus)
+{
+	int i;
+
 	if (irqstatus & DSI_IRQ_ERROR_MASK) {
 		DSSERR("DSI error, irqstatus %x\n", irqstatus);
 		print_irq_status(irqstatus);
@@ -510,37 +517,48 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
 		print_irq_status(irqstatus);
 	}
 
-#ifdef DSI_CATCH_MISSING_TE
-	if (irqstatus & DSI_IRQ_TE_TRIGGER)
-		del_timer(&dsi.te_timer);
-#endif
-
 	for (i = 0; i < 4; ++i) {
-		if ((irqstatus & (1<<i)) = 0)
-			continue;
+		if (vcstatus[i] & DSI_VC_IRQ_ERROR_MASK) {
+			DSSERR("DSI VC(%d) error, vc irqstatus %x\n",
+				       i, vcstatus[i]);
+			print_irq_status_vc(i, vcstatus[i]);
+		} else if (debug_irq) {
+			print_irq_status_vc(i, vcstatus[i]);
+		}
+	}
 
-		vcstatus = dsi_read_reg(DSI_VC_IRQSTATUS(i));
+	if (ciostatus & DSI_CIO_IRQ_ERROR_MASK) {
+		DSSERR("DSI CIO error, cio irqstatus %x\n", ciostatus);
+		print_irq_status_cio(ciostatus);
+	} else if (debug_irq) {
+		print_irq_status_cio(ciostatus);
+	}
+}
 
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
-		dss_collect_irq_stats(vcstatus, dsi.irq_stats.vc_irqs[i]);
-#endif
+static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
+{
+	u32 irqstatus, vcstatus[4], ciostatus;
+	int i;
 
-		if (vcstatus & DSI_VC_IRQ_BTA) {
-			complete(&dsi.bta_completion);
+	irqstatus = dsi_read_reg(DSI_IRQSTATUS);
 
-			if (dsi.bta_callback)
-				dsi.bta_callback();
-		}
+	/* IRQ is not for us */
+	if (!irqstatus)
+		return IRQ_NONE;
 
-		if (vcstatus & DSI_VC_IRQ_ERROR_MASK) {
-			DSSERR("DSI VC(%d) error, vc irqstatus %x\n",
-				       i, vcstatus);
-			print_irq_status_vc(i, vcstatus);
-		} else if (debug_irq) {
-			print_irq_status_vc(i, vcstatus);
+	dsi_write_reg(DSI_IRQSTATUS, irqstatus & ~DSI_IRQ_CHANNEL_MASK);
+	/* flush posted write */
+	dsi_read_reg(DSI_IRQSTATUS);
+
+	for (i = 0; i < 4; ++i) {
+		if ((irqstatus & (1 << i)) = 0) {
+			vcstatus[i] = 0;
+			continue;
 		}
 
-		dsi_write_reg(DSI_VC_IRQSTATUS(i), vcstatus);
+		vcstatus[i] = dsi_read_reg(DSI_VC_IRQSTATUS(i));
+
+		dsi_write_reg(DSI_VC_IRQSTATUS(i), vcstatus[i]);
 		/* flush posted write */
 		dsi_read_reg(DSI_VC_IRQSTATUS(i));
 	}
@@ -548,29 +566,34 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
 	if (irqstatus & DSI_IRQ_COMPLEXIO_ERR) {
 		ciostatus = dsi_read_reg(DSI_COMPLEXIO_IRQ_STATUS);
 
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
-		dss_collect_irq_stats(ciostatus, dsi.irq_stats.cio_irqs);
-#endif
-
 		dsi_write_reg(DSI_COMPLEXIO_IRQ_STATUS, ciostatus);
 		/* flush posted write */
 		dsi_read_reg(DSI_COMPLEXIO_IRQ_STATUS);
+	} else {
+		ciostatus = 0;
+	}
 
-		if (ciostatus & DSI_CIO_IRQ_ERROR_MASK) {
-			DSSERR("DSI CIO error, cio irqstatus %x\n", ciostatus);
-			print_irq_status_cio(ciostatus);
-		} else if (debug_irq) {
-			print_irq_status_cio(ciostatus);
+#ifdef DSI_CATCH_MISSING_TE
+	if (irqstatus & DSI_IRQ_TE_TRIGGER)
+		del_timer(&dsi.te_timer);
+#endif
+
+	for (i = 0; i < 4; ++i) {
+		if (vcstatus[i] = 0)
+			continue;
+
+		if (vcstatus[i] & DSI_VC_IRQ_BTA) {
+			complete(&dsi.bta_completion);
+
+			if (dsi.bta_callback)
+				dsi.bta_callback();
 		}
 	}
 
-	dsi_write_reg(DSI_IRQSTATUS, irqstatus & ~DSI_IRQ_CHANNEL_MASK);
-	/* flush posted write */
-	dsi_read_reg(DSI_IRQSTATUS);
+	dsi_handle_irq_errors(irqstatus, vcstatus, ciostatus);
+
+	dsi_collect_irq_stats(irqstatus, vcstatus, ciostatus);
 
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
-	spin_unlock(&dsi.irq_stats_lock);
-#endif
 	return IRQ_HANDLED;
 }
 
-- 
1.7.1


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox