Re: [PATCH] usb: gadget: mass_storage: Use static array for luns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 07/30/2015 06:43 PM, Felipe Balbi wrote:
Hi,

On Thu, Jul 23, 2015 at 07:57:49PM +0200, Krzysztof Opasiak wrote:
This patch replace dynamicly allocated luns array with static one.
This simplifies the code of mass storage function and modules.

Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx>

this actually regresses g_mass_storage:

# modprobe g_mass_storage removable=1
[   40.115294] Mass Storage Function, version: 2009/09/11
[   40.120680] LUN: removable file: (no medium)
[   40.125374] Unable to handle kernel NULL pointer dereference at virtual address 00000054
[   40.133863] pgd = ed574000
[   40.136689] [00000054] *pgd=00000000
[   40.140429] Internal error: Oops: 5 [#1] SMP ARM
[   40.145238] Modules linked in: g_mass_storage(+) usb_f_mass_storage libcomposite xhci_plat_hcd xhci_hcd usbcore joydev dwc3 udc_core usb_common evdev cpufreq_dt omapfb snd_soc_evm thermal_sys cfbfillrect cfbimgblt cfbcopyarea matrix_keypad hwmon leds_gpio led_class matrix_keymap pwm_bl panel_dpi snd_soc_tlv320aic3x snd_soc_davinci_mcasp snd_soc_edma snd_soc_omap snd_soc_core omapdss snd_compress snd_pcm_dmaengine snd_pcm dwc3_omap snd_timer lis3lv02d_i2c extcon pwm_tiecap snd lis3lv02d input_polldev soundcore rtc_omap spi_ti_qspi omap_wdt tps65218_pwrbutton phy_omap_usb2 ipv6 autofs4
[   40.199522] CPU: 0 PID: 244 Comm: modprobe Not tainted 4.2.0-rc4-00060-g691ddfcf5846 #755
[   40.208039] Hardware name: Generic AM43 (Flattened Device Tree)
[   40.214210] task: ed01e240 ti: ee7be000 task.ti: ee7be000
[   40.219843] PC is at kernfs_find_ns+0xc/0x138
[   40.224381] LR is at kernfs_find_and_get_ns+0x30/0x4c
[   40.229649] pc : [<c01de508>]    lr : [<c01de664>]    psr: 200f0013
[   40.229649] sp : ee7bfc68  ip : 00000002  fp : bf0aa740
[   40.241609] r10: bf0aa788  r9 : ed3353c0  r8 : 00000000
[   40.247055] r7 : 00000000  r6 : c06466a4  r5 : 00000000  r4 : c0917840
[   40.253851] r3 : c093c5d4  r2 : 00000000  r1 : c06466a4  r0 : 00000000
[   40.260651] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   40.268085] Control: 10c5387d  Table: ad574059  DAC: 00000015
[   40.274069] Process modprobe (pid: 244, stack limit = 0xee7be218)
[   40.280415] Stack: (0xee7bfc68 to 0xee7c0000)
[   40.284959] fc60:                   c0917840 00000000 c06466a4 00000000 ed214400 c01de664
[   40.293478] fc80: 00000000 c09474d0 ee56f438 ee56f430 00000000 c01e13d4 00000000 c09474a0
[   40.301996] fca0: ee56f438 c03f6384 ee56f430 ee56f430 ed214598 c03ec6d0 bf0aa788 c008e820
[   40.310519] fcc0: c015a7d4 ed01e240 ee56f430 ed2144d0 ed214598 ed21450c ed214400 c03ec8b8
[   40.319048] fce0: ee56f400 bf10f304 ee533e00 ee533e04 bf0aa980 bf0aa54c 00000001 bf10f374
[   40.327572] fd00: bf115840 bf07ec18 fffffff0 bf0aa0a0 c05fe878 00000001 00000000 00000100
[   40.336089] fd20: ed506098 00000000 00000000 00000000 bf2f8528 c0979e80 600f0093 c0091548
[   40.344612] fd40: 00000001 00000080 00000000 bf2f8528 00000000 ed01e768 ed01e240 00000004
[   40.353137] fd60: 00000006 12d341e8 bf0aa788 c008e820 c06008b8 ed01e240 00000001 bf0aa694
[   40.361654] fd80: 00000000 c008e984 a00f0013 ed506088 ed506088 c06008b8 00000000 00000000
[   40.370172] fda0: 00000000 00000000 ed335301 00000002 00000000 ed3353c0 bf0aa6bc 00000000
[   40.378690] fdc0: ed506170 00000000 12d341e8 bf07ea84 bf2e7d08 ee53b000 bf0aa6bc ee53b000
[   40.387207] fde0: bf0aa6bc ed2cbd00 ee53b008 00000000 12d341e8 bf0aa788 bf0aa740 bf2e7b90
[   40.395724] fe00: 00000000 bf2e8308 bf0aa6bc ed2cbd00 bf0b0000 bf2e7d44 00000000 c08c9ea0
[   40.404241] fe20: c08c9ea0 c00097a4 00000001 00000000 00000000 c0150fe4 00000000 eeef9000
[   40.412766] fe40: ef7c8460 40000000 0000001e c008ec68 ee5e1e40 000000d0 000000d0 c015ba10
[   40.421283] fe60: ee7bff58 c008ec68 c08c63a8 600f0013 a00f0013 bf0aa740 bf0aa740 c0979fd4
[   40.429811] fe80: ee5e1e40 ed2cbe40 00000001 bf0aa788 bf0aa740 c05f7d28 c0979fd4 00000001
[   40.438334] fea0: ee7bff58 c0979fd4 00000001 c00c88c4 bf0aa74c 00007fff 00000000 c00c606c
[   40.446857] fec0: c1153024 00000124 bf0aa74c bf0aa95c ee7bff60 f03a29a4 bf0aa74c 00000000
[   40.455381] fee0: 02e401dd 00000000 0000000f 000181a4 00000001 00000000 00000000 00000000
[   40.463900] ff00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   40.472424] ff20: 00000000 00000000 00000000 00000000 7f643410 00000000 00000005 7f643410
[   40.480941] ff40: 0000017b c000f724 ee7be000 00000000 7f6431c8 c00c91c0 f0385000 0001d9f4
[   40.489471] ff60: f03a2314 f039a942 f039b5e0 000009a8 00000e38 00000000 00000000 00000000
[   40.497993] ff80: 0000002a 0000002b 00000012 00000016 0000000b 00000000 00000000 0000000b
[   40.506537] ffa0: 0000000b c000f540 00000000 0000000b 00000005 7f643410 00000000 7f6431b0
[   40.515062] ffc0: 00000000 0000000b 0000000b 0000017b 00040000 0000000b 0000000b 7f6431c8
[   40.523579] ffe0: bea6a9a0 bea6a990 7f62643f b6f52812 600f0030 00000005 0001bccc 0098b800
[   40.532117] [<c01de508>] (kernfs_find_ns) from [<c09474d0>] (pm_qos_latency_tolerance_attr_group+0x0/0x10)
[   40.542174] Code: e8bd8038 e59f3110 e92d41f0 e1a08000 (e1d055b4)
[   40.548588] ---[ end trace 90f09a046515cfcf ]---


bisection log:

git bisect start
# good: [cbfe8fa6cd672011c755c3cd85c9ffd4e2d10a6f] Linux 4.2-rc4
git bisect good cbfe8fa6cd672011c755c3cd85c9ffd4e2d10a6f
# bad: [c6ba8dabf920ff5a95cf5678a9523c362b0cdea4] usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth
git bisect bad c6ba8dabf920ff5a95cf5678a9523c362b0cdea4
# good: [6a88bbe8e30d4beb2320b5a7452242a1fe7889c5] usb: otg: add usb_otg_caps structure for otg capabilities
git bisect good 6a88bbe8e30d4beb2320b5a7452242a1fe7889c5
# good: [3dcc7053087fb58c799cd964a00a5396bec3bc9e] usb: gadget: serial: allocate and init otg descriptor by otg capabilities
git bisect good 3dcc7053087fb58c799cd964a00a5396bec3bc9e
# bad: [3001951f6e2ff8d6b45ac64b3927d99dd761e8e1] usb: gadget: add 'quirk_altset_not_supp' to usb_gadget
git bisect bad 3001951f6e2ff8d6b45ac64b3927d99dd761e8e1
# bad: [5f439a6c2f8e18dc8e2730c8515fad290c7d1ea4] usb: dwc3: ep0: use _roundup_ to calculate the transfer size
git bisect bad 5f439a6c2f8e18dc8e2730c8515fad290c7d1ea4
# good: [b5a2875605cac14a7d7744ec8254547a26c02612] usb: renesas_usbhs: Allow an OTG PHY driver to provide VBUS
git bisect good b5a2875605cac14a7d7744ec8254547a26c02612
# bad: [64613d253fa4bc0efd7782fc05e9d451dfc49df2] usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes
git bisect bad 64613d253fa4bc0efd7782fc05e9d451dfc49df2
# bad: [691ddfcf58461942b43b0ed160682b2d5f14fa27] usb: gadget: mass_storage: Use static array for luns
git bisect bad 691ddfcf58461942b43b0ed160682b2d5f14fa27
# first bad commit: [691ddfcf58461942b43b0ed160682b2d5f14fa27] usb: gadget: mass_storage: Use static array for luns

I'll drop this from my queue for now

Some ugly bug from f_mass_storage has been exposed by this patch. I have just prepared a fix for it and send to linux-usb[1]. I have also rebased this patch on that fix as it depends on it.

Apart from that bug which caused this NULL pointer dereference I found that one line is missing my patch so I've added it and resend this as v2[2].

I'm really sorry for this problem.

Footnotes:
1 - http://article.gmane.org/gmane.linux.usb.general/129000
2 - http://article.gmane.org/gmane.linux.usb.general/129001

Best regards,
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux